@sharpapi/sharpapi-node-parse-resume 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +382 -0
- package/package.json +40 -0
- package/src/SharpApiParseResumeService.js +27 -0
- package/src/index.js +6 -0
package/README.md
ADDED
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# Resume/CV Parser API for Node.js
|
|
4
|
+
|
|
5
|
+
## 📄 Parse resumes and extract structured data with AI — powered by SharpAPI.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@sharpapi/sharpapi-node-parse-resume)
|
|
8
|
+
[](https://github.com/sharpapi/sharpapi-node-client/blob/master/LICENSE.md)
|
|
9
|
+
|
|
10
|
+
**SharpAPI Resume Parser** extracts structured information from resume/CV documents in various formats (PDF, DOC, DOCX, TXT). Perfect for ATS systems, recruitment platforms, and HR automation tools.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 📋 Table of Contents
|
|
15
|
+
|
|
16
|
+
1. [Requirements](#requirements)
|
|
17
|
+
2. [Installation](#installation)
|
|
18
|
+
3. [Usage](#usage)
|
|
19
|
+
4. [API Documentation](#api-documentation)
|
|
20
|
+
5. [Response Format](#response-format)
|
|
21
|
+
6. [Examples](#examples)
|
|
22
|
+
7. [License](#license)
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Requirements
|
|
27
|
+
|
|
28
|
+
- Node.js >= 16.x
|
|
29
|
+
- npm or yarn
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
### Step 1. Install the package via npm:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install @sharpapi/sharpapi-node-parse-resume
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Step 2. Get your API key
|
|
42
|
+
|
|
43
|
+
Visit [SharpAPI.com](https://sharpapi.com/) to get your API key.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
```javascript
|
|
50
|
+
const { SharpApiParseResumeService } = require('@sharpapi/sharpapi-node-parse-resume');
|
|
51
|
+
const fs = require('fs');
|
|
52
|
+
|
|
53
|
+
const apiKey = process.env.SHARP_API_KEY;
|
|
54
|
+
const service = new SharpApiParseResumeService(apiKey);
|
|
55
|
+
|
|
56
|
+
async function parseResume() {
|
|
57
|
+
try {
|
|
58
|
+
// Read resume file
|
|
59
|
+
const resumeFile = fs.readFileSync('/path/to/resume.pdf');
|
|
60
|
+
|
|
61
|
+
// Submit parsing job
|
|
62
|
+
const statusUrl = await service.parseResume(resumeFile, 'resume.pdf', 'English');
|
|
63
|
+
console.log('Job submitted. Status URL:', statusUrl);
|
|
64
|
+
|
|
65
|
+
// Fetch results (polls automatically until complete)
|
|
66
|
+
const result = await service.fetchResults(statusUrl);
|
|
67
|
+
const parsedData = result.getResultJson();
|
|
68
|
+
|
|
69
|
+
console.log('Candidate:', parsedData.result.name);
|
|
70
|
+
console.log('Email:', parsedData.result.email);
|
|
71
|
+
console.log('Skills:', parsedData.result.skills.join(', '));
|
|
72
|
+
} catch (error) {
|
|
73
|
+
console.error('Error:', error.message);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
parseResume();
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## API Documentation
|
|
83
|
+
|
|
84
|
+
### Methods
|
|
85
|
+
|
|
86
|
+
#### `parseResume(fileBuffer: Buffer, fileName: string, language?: string): Promise<string>`
|
|
87
|
+
|
|
88
|
+
Parses a resume/CV file and extracts structured information.
|
|
89
|
+
|
|
90
|
+
**Parameters:**
|
|
91
|
+
- `fileBuffer` (Buffer, required): The resume file content as a Buffer
|
|
92
|
+
- `fileName` (string, required): Original filename with extension (e.g., 'resume.pdf')
|
|
93
|
+
- `language` (string, optional): Expected resume language (default: 'English')
|
|
94
|
+
|
|
95
|
+
**Supported File Formats:**
|
|
96
|
+
- PDF (.pdf)
|
|
97
|
+
- Microsoft Word (.doc, .docx)
|
|
98
|
+
- Plain Text (.txt)
|
|
99
|
+
- Rich Text Format (.rtf)
|
|
100
|
+
|
|
101
|
+
**Returns:**
|
|
102
|
+
- Promise<string>: Status URL for polling the job result
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Response Format
|
|
107
|
+
|
|
108
|
+
The API returns comprehensive structured data extracted from the resume:
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"data": {
|
|
113
|
+
"type": "api_job_result",
|
|
114
|
+
"id": "5de4887a-0dfd-49b6-8edb-9280e468c210",
|
|
115
|
+
"attributes": {
|
|
116
|
+
"status": "success",
|
|
117
|
+
"type": "hr_parse_resume",
|
|
118
|
+
"result": {
|
|
119
|
+
"name": "John Doe",
|
|
120
|
+
"email": "john.doe@email.com",
|
|
121
|
+
"phone": "+1-555-123-4567",
|
|
122
|
+
"location": {
|
|
123
|
+
"city": "San Francisco",
|
|
124
|
+
"state": "California",
|
|
125
|
+
"country": "United States"
|
|
126
|
+
},
|
|
127
|
+
"summary": "Experienced software engineer with 8+ years in full-stack development, specializing in cloud-native applications and microservices architecture.",
|
|
128
|
+
"work_experience": [
|
|
129
|
+
{
|
|
130
|
+
"job_title": "Senior Software Engineer",
|
|
131
|
+
"company": "Tech Corp",
|
|
132
|
+
"location": "San Francisco, CA",
|
|
133
|
+
"start_date": "2020-03",
|
|
134
|
+
"end_date": "Present",
|
|
135
|
+
"description": "Led development of microservices architecture, improved system performance by 40%, mentored junior developers."
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"job_title": "Software Engineer",
|
|
139
|
+
"company": "StartupXYZ",
|
|
140
|
+
"location": "San Francisco, CA",
|
|
141
|
+
"start_date": "2017-06",
|
|
142
|
+
"end_date": "2020-02",
|
|
143
|
+
"description": "Developed RESTful APIs and implemented CI/CD pipelines."
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
"education": [
|
|
147
|
+
{
|
|
148
|
+
"degree": "Bachelor of Science in Computer Science",
|
|
149
|
+
"institution": "University of California",
|
|
150
|
+
"location": "Berkeley, CA",
|
|
151
|
+
"graduation_date": "2017-05"
|
|
152
|
+
}
|
|
153
|
+
],
|
|
154
|
+
"skills": [
|
|
155
|
+
"JavaScript",
|
|
156
|
+
"Node.js",
|
|
157
|
+
"React",
|
|
158
|
+
"AWS",
|
|
159
|
+
"Docker",
|
|
160
|
+
"Kubernetes",
|
|
161
|
+
"PostgreSQL",
|
|
162
|
+
"MongoDB",
|
|
163
|
+
"CI/CD",
|
|
164
|
+
"Agile"
|
|
165
|
+
],
|
|
166
|
+
"certifications": [
|
|
167
|
+
{
|
|
168
|
+
"name": "AWS Certified Solutions Architect",
|
|
169
|
+
"issuer": "Amazon Web Services",
|
|
170
|
+
"date": "2021-08"
|
|
171
|
+
}
|
|
172
|
+
],
|
|
173
|
+
"languages": [
|
|
174
|
+
{
|
|
175
|
+
"language": "English",
|
|
176
|
+
"proficiency": "Native"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"language": "Spanish",
|
|
180
|
+
"proficiency": "Intermediate"
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Examples
|
|
192
|
+
|
|
193
|
+
### Parse Single Resume
|
|
194
|
+
|
|
195
|
+
```javascript
|
|
196
|
+
const { SharpApiParseResumeService } = require('@sharpapi/sharpapi-node-parse-resume');
|
|
197
|
+
const fs = require('fs');
|
|
198
|
+
|
|
199
|
+
const service = new SharpApiParseResumeService(process.env.SHARP_API_KEY);
|
|
200
|
+
|
|
201
|
+
async function parseAndDisplay(resumePath) {
|
|
202
|
+
const fileBuffer = fs.readFileSync(resumePath);
|
|
203
|
+
const fileName = resumePath.split('/').pop();
|
|
204
|
+
|
|
205
|
+
const statusUrl = await service.parseResume(fileBuffer, fileName);
|
|
206
|
+
const result = await service.fetchResults(statusUrl);
|
|
207
|
+
const data = result.getResultJson().result;
|
|
208
|
+
|
|
209
|
+
console.log('📋 Resume Summary:');
|
|
210
|
+
console.log(`Name: ${data.name}`);
|
|
211
|
+
console.log(`Email: ${data.email}`);
|
|
212
|
+
console.log(`Phone: ${data.phone}`);
|
|
213
|
+
console.log(`Location: ${data.location.city}, ${data.location.country}`);
|
|
214
|
+
console.log(`\nExperience: ${data.work_experience.length} positions`);
|
|
215
|
+
console.log(`Education: ${data.education.length} degrees`);
|
|
216
|
+
console.log(`Skills: ${data.skills.join(', ')}`);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
parseAndDisplay('./resumes/john_doe_resume.pdf');
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Batch Resume Processing
|
|
223
|
+
|
|
224
|
+
```javascript
|
|
225
|
+
const service = new SharpApiParseResumeService(process.env.SHARP_API_KEY);
|
|
226
|
+
const fs = require('fs');
|
|
227
|
+
const path = require('path');
|
|
228
|
+
|
|
229
|
+
async function processBatchResumes(resumeDirectory) {
|
|
230
|
+
const files = fs.readdirSync(resumeDirectory);
|
|
231
|
+
const candidates = [];
|
|
232
|
+
|
|
233
|
+
for (const file of files) {
|
|
234
|
+
if (file.match(/\.(pdf|docx|doc)$/i)) {
|
|
235
|
+
const filePath = path.join(resumeDirectory, file);
|
|
236
|
+
const fileBuffer = fs.readFileSync(filePath);
|
|
237
|
+
|
|
238
|
+
try {
|
|
239
|
+
const statusUrl = await service.parseResume(fileBuffer, file);
|
|
240
|
+
const result = await service.fetchResults(statusUrl);
|
|
241
|
+
const data = result.getResultJson().result;
|
|
242
|
+
|
|
243
|
+
candidates.push({
|
|
244
|
+
fileName: file,
|
|
245
|
+
name: data.name,
|
|
246
|
+
email: data.email,
|
|
247
|
+
skills: data.skills,
|
|
248
|
+
experience: data.work_experience.length,
|
|
249
|
+
parsedSuccessfully: true
|
|
250
|
+
});
|
|
251
|
+
} catch (error) {
|
|
252
|
+
candidates.push({
|
|
253
|
+
fileName: file,
|
|
254
|
+
parsedSuccessfully: false,
|
|
255
|
+
error: error.message
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return candidates;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const allCandidates = await processBatchResumes('./incoming_resumes');
|
|
265
|
+
console.log(`Processed ${allCandidates.length} resumes`);
|
|
266
|
+
console.log(`Successful: ${allCandidates.filter(c => c.parsedSuccessfully).length}`);
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### ATS Integration
|
|
270
|
+
|
|
271
|
+
```javascript
|
|
272
|
+
const service = new SharpApiParseResumeService(process.env.SHARP_API_KEY);
|
|
273
|
+
|
|
274
|
+
async function addCandidateToATS(resumeBuffer, fileName, jobId) {
|
|
275
|
+
// Parse resume
|
|
276
|
+
const statusUrl = await service.parseResume(resumeBuffer, fileName);
|
|
277
|
+
const result = await service.fetchResults(statusUrl);
|
|
278
|
+
const parsedData = result.getResultJson().result;
|
|
279
|
+
|
|
280
|
+
// Structure for ATS
|
|
281
|
+
const candidateProfile = {
|
|
282
|
+
jobApplicationId: jobId,
|
|
283
|
+
personalInfo: {
|
|
284
|
+
fullName: parsedData.name,
|
|
285
|
+
email: parsedData.email,
|
|
286
|
+
phone: parsedData.phone,
|
|
287
|
+
location: `${parsedData.location.city}, ${parsedData.location.country}`
|
|
288
|
+
},
|
|
289
|
+
professionalSummary: parsedData.summary,
|
|
290
|
+
totalExperience: calculateTotalExperience(parsedData.work_experience),
|
|
291
|
+
skills: parsedData.skills,
|
|
292
|
+
education: parsedData.education,
|
|
293
|
+
workHistory: parsedData.work_experience,
|
|
294
|
+
certifications: parsedData.certifications || [],
|
|
295
|
+
languages: parsedData.languages || [],
|
|
296
|
+
resumeSource: 'automated_parsing',
|
|
297
|
+
parsedAt: new Date().toISOString()
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
return candidateProfile;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
function calculateTotalExperience(workHistory) {
|
|
304
|
+
// Calculate years of experience
|
|
305
|
+
let totalMonths = 0;
|
|
306
|
+
workHistory.forEach(job => {
|
|
307
|
+
const start = new Date(job.start_date);
|
|
308
|
+
const end = job.end_date === 'Present' ? new Date() : new Date(job.end_date);
|
|
309
|
+
totalMonths += (end.getFullYear() - start.getFullYear()) * 12 +
|
|
310
|
+
(end.getMonth() - start.getMonth());
|
|
311
|
+
});
|
|
312
|
+
return `${Math.floor(totalMonths / 12)} years, ${totalMonths % 12} months`;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
const candidateProfile = await addCandidateToATS(resumeBuffer, 'resume.pdf', 'JOB-12345');
|
|
316
|
+
console.log('Candidate added to ATS:', candidateProfile.personalInfo.fullName);
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## Use Cases
|
|
322
|
+
|
|
323
|
+
- **Applicant Tracking Systems**: Automatically parse incoming resumes
|
|
324
|
+
- **Recruitment Platforms**: Extract candidate information for matching
|
|
325
|
+
- **HR Automation**: Streamline resume screening processes
|
|
326
|
+
- **Talent Databases**: Build searchable candidate databases
|
|
327
|
+
- **Job Boards**: Enable resume upload and parsing features
|
|
328
|
+
- **Recruitment Agencies**: Process high volumes of resumes efficiently
|
|
329
|
+
- **Career Portals**: Parse user-uploaded resumes for profile creation
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
## Extraction Capabilities
|
|
334
|
+
|
|
335
|
+
The parser extracts:
|
|
336
|
+
|
|
337
|
+
- **Personal Information**: Name, email, phone, location
|
|
338
|
+
- **Professional Summary**: Career objective or summary statement
|
|
339
|
+
- **Work Experience**: Job titles, companies, dates, descriptions
|
|
340
|
+
- **Education**: Degrees, institutions, graduation dates
|
|
341
|
+
- **Skills**: Technical and soft skills
|
|
342
|
+
- **Certifications**: Professional certifications and credentials
|
|
343
|
+
- **Languages**: Spoken languages and proficiency levels
|
|
344
|
+
- **Projects**: Notable projects (when available)
|
|
345
|
+
- **Publications**: Academic or professional publications
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
## API Endpoint
|
|
350
|
+
|
|
351
|
+
**POST** `/hr/parse_resume` (multipart/form-data)
|
|
352
|
+
|
|
353
|
+
For detailed API specifications, refer to:
|
|
354
|
+
- [Postman Documentation](https://documenter.getpostman.com/view/31106842/2sBXVeGsVL)
|
|
355
|
+
- [Product Page](https://sharpapi.com/en/catalog/ai/hr-tech/resume-cv-parsing)
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
## Related Packages
|
|
360
|
+
|
|
361
|
+
- [@sharpapi/sharpapi-node-resume-job-match-score](https://www.npmjs.com/package/@sharpapi/sharpapi-node-resume-job-match-score) - Resume-job matching
|
|
362
|
+
- [@sharpapi/sharpapi-node-job-description](https://www.npmjs.com/package/@sharpapi/sharpapi-node-job-description) - Job descriptions
|
|
363
|
+
- [@sharpapi/sharpapi-node-related-skills](https://www.npmjs.com/package/@sharpapi/sharpapi-node-related-skills) - Skills analysis
|
|
364
|
+
- [@sharpapi/sharpapi-node-client](https://www.npmjs.com/package/@sharpapi/sharpapi-node-client) - Full SharpAPI SDK
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
## License
|
|
369
|
+
|
|
370
|
+
This project is licensed under the MIT License. See the [LICENSE.md](LICENSE.md) file for details.
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
## Support
|
|
375
|
+
|
|
376
|
+
- **Documentation**: [SharpAPI.com Documentation](https://sharpapi.com/documentation)
|
|
377
|
+
- **Issues**: [GitHub Issues](https://github.com/sharpapi/sharpapi-node-client/issues)
|
|
378
|
+
- **Email**: contact@sharpapi.com
|
|
379
|
+
|
|
380
|
+
---
|
|
381
|
+
|
|
382
|
+
**Powered by [SharpAPI](https://sharpapi.com/) - AI-Powered API Workflow Automation**
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sharpapi/sharpapi-node-parse-resume",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "SharpAPI.com Node.js SDK for parsing resumes",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "jest"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"sharpapi",
|
|
11
|
+
"ai-powered",
|
|
12
|
+
"ai capabilities",
|
|
13
|
+
"api",
|
|
14
|
+
"ai api",
|
|
15
|
+
"api integration",
|
|
16
|
+
"artificial intelligence",
|
|
17
|
+
"natural language processing",
|
|
18
|
+
"restful api",
|
|
19
|
+
"nodejs",
|
|
20
|
+
"software development",
|
|
21
|
+
"hr tech",
|
|
22
|
+
"resume parsing",
|
|
23
|
+
"cv parsing"
|
|
24
|
+
],
|
|
25
|
+
"author": "Dawid Makowski <contact@sharpapi.com>",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@sharpapi/sharpapi-node-core": "file:../sharpapi-node-core"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"jest": "^29.7.0"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "https://github.com/sharpapi/sharpapi-node-parse-resume.git"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const { SharpApiCoreService, SharpApiJobTypeEnum } = require('@sharpapi/sharpapi-node-core');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Service for parsing resumes using SharpAPI.com
|
|
5
|
+
*/
|
|
6
|
+
class SharpApiParseResumeService extends SharpApiCoreService {
|
|
7
|
+
/**
|
|
8
|
+
* Parses a resume (CV) file from multiple formats (PDF/DOC/DOCX/TXT/RTF)
|
|
9
|
+
* and returns an extensive JSON object of data points.
|
|
10
|
+
*
|
|
11
|
+
* An optional language parameter can also be provided (`English` value is set as the default one).
|
|
12
|
+
*
|
|
13
|
+
* @param {string} filePath - The path to the resume file.
|
|
14
|
+
* @param {string|null} language - The language of the resume file. Defaults to 'English'.
|
|
15
|
+
* @returns {Promise<string>} - The status URL.
|
|
16
|
+
*/
|
|
17
|
+
async parseResume(filePath, language = null) {
|
|
18
|
+
const data = {};
|
|
19
|
+
if (language) {
|
|
20
|
+
data.language = language;
|
|
21
|
+
}
|
|
22
|
+
const response = await this.makeRequest('POST', SharpApiJobTypeEnum.HR_PARSE_RESUME.url, data, filePath);
|
|
23
|
+
return this.parseStatusUrl(response);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
module.exports = { SharpApiParseResumeService };
|