-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #143 from hoangr1010/Autofill-profile
pdf parsing file from s3
- Loading branch information
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import pdf from "pdf-parse"; | ||
import axios from "axios"; | ||
export const getResumeFromS3 = async (resume_url) => { | ||
const pdfUrl = resume_url; | ||
|
||
const response = await axios.get(pdfUrl, { responseType: "arraybuffer" }); | ||
return response.data; | ||
}; | ||
|
||
const parsePdf = async (filePath) => { | ||
try { | ||
const dataBuffer = await getResumeFromS3(filePath); | ||
const data = await pdf(dataBuffer); | ||
|
||
return data.text; | ||
} catch (error) { | ||
console.error("Error parsing PDF:", error); | ||
} | ||
}; | ||
|
||
export default parsePdf; |