Help with finding local full path of the document being uploaded

Hi , I am trying to build a pdf parser, I am using the fs-extra npm module. The fs-extra module readFileSync method needs the full path of the file on the customers machine which was uploaded.
let dataBuffer = fs . readFileSync ( //Full path of the uploaded file );

I tried giving both the path after the file was uploaded

  1. wix:document://v1/

  2. ttps://docs.wixstatic.com/ugd/

It cannot read any of these paths. I think it needs a local path of the file on the users machine. Can someone help me code to finding the local path when the user is trying to upload a file ?

@russian-dima do you have any tips here

PDF-Parser → bigger project in front of you.

Normaly you should get the full path of the already uploded file, as i can remember.

  1. How do you upload your PDF-File?
    a) using the UPLOAD-BUTTON?
  2. doing it from backend of Media-Manager-API ?

https://www.wix.com/velo/reference/wix-media-backend/mediamanager-obj

https://www.wix.com/velo/reference/wix-media-backend/mediamanager-obj/upload

https://www.wix.com/velo/reference/wix-media-backend/mediamanager-obj/getuploadurl

https://www.wix.com/velo/reference/wix-media-backend/mediamanager-obj/getdownloadurl

One of these should fit your needs.

https://www.wix.com/velo/reference/wix-media-backend/mediamanager-obj/getfileinfo

https://www.wix.com/velo/reference/wix-media-backend/mediamanager-obj/getfolderinfo

Pay attention, these will work on BACKEND-ONLY.

Thanks @russian-dima . I already looked into these apis. The problem is

fs . readFileSync (//path) only accepts local file path as input. It does not accept any url. I need the local path of the file on my device when i click the upload button. I wanted to see how do i grab the local path of the file on the users device when they upload a document.

Unless you know how readFileSync will work with a static web url. (I already have the full url of the pdf file) which doesnt seem to work with this api.

For your info…

I can just give you some links about your issue.
This would be a time-intensive work for me to get it resolved.

Read all this… find your hints and important info you can use in your project.
https://nodejs.org/api/fs.html#fs_fs_readfilesync_path_options

You surely will find much more info about “readFileSync” if you search for it more intensive.

Another question, what for do you need “readFileSync-Method” exactly ?
How does it help you ?

Thanks @russian-dima . I had seen these and tried suggestions but i get an error when using a url.
My use case:
When a member uploads a resume pdf using the wix upload button it uploads the resume pdf on wix and wix returns a static url. I want to then use this pdf to parse certain text from the resume pdf and store it in my db collection. That is why i am call this readFileSync() method from the fs-extra npm package to help me readFileSync() and then i call the pdf parse to parse text on the buffer returned from the readFileSync() method.

Back to your response…

(I already have the full url of the pdf file) which doesnt seem to work with this api.)

How do look like your FULL-URL ???
How did you generated it?

Or did you just look into the Media-Manager and copied from there?

Is your PDF-FILE similar to this one?
https://57da6cbf-baea-4248-8b1c-e7e82fcc01f8.usrfiles.com/ugd/e733d8_a5bc2ed5efd641a4b56874dd92332063.pdf

EDIT: Maybe one of my old POSTS can help you out…

Take a look onto comments from → " yvervoort "

The above url you shared is exactly like the url i have for my pdf file

I had also a hard time with → BUFFER ← and co. :grin:
My way was the HTML-Component as i can remember.

@russian-dima - got the pdf reader working. thanks for your help.

:wink:
What was your solution ?

  1. HTML-Component?
  2. NPM-Module?
  3. Something else ?