-
-
Notifications
You must be signed in to change notification settings - Fork 742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Impossible to correctly save a file generated from the webpage inside a particular folder using local chrome (not chromium) #497
Comments
This is unreadable, please provide a small, self-contained script (stripped to the essentials) that showcases the issue. :-) |
Ah, you were the one commenting in the previous issue: #44 (comment) Did you try a minimal/new script with just the code mentioned in that issue? |
Ok, shortly, I want this to work as expected :
My file is still downloaded in the "download" folder of windows |
PPS: Seems like you're running on Windows - I doubt that |
Tip: You can just check the Preferences file your regular browser creates and see what data is written there. |
"tmp" is the name of my folder. But it doesn't work with another name neither
But it didn't change anything |
I don't understand (?) |
Folders starting with a
|
Ok , I just updated the code like that
But it doesn"t work neither. Concerning the preference, it's not a good solution because when my project will work, it will be deployed on dozens of servers, and I would like something that works without doing anything else , but thank you for your suggestion (and thank your for your reactivity ! ) |
Servers running Linux? Then you should run this in a docker container or on linux as well. My point was that you can use your regular Preferences file to find out how the |
Just look at this:
I'm pretty sure your |
My default_directory path looks like this "I'm pretty sure your default_directory path needs to be absolute and be escaped as well." I just tryed with an absolute path to my folder and it worked !!! What if I really want a relative path ? |
(It's incredible how reactive you are ! Thank you so much for your help ! ) |
There's no relative path in that thread. 😄 If you need a relative path why not use JS to dynamically generate an absolute path when instantiating the UserPreferencesPlugin? |
Nice idea, I will do that ! THANK YOU A LOT ! |
Gonna close this for now, I recommend using https://extra.community for issues like this. :-) |
Since yesterday, I'm trying to save a file created in the webpage inside a particular folder (another folder than the "download" folder of windows).
I first tryed something like this :
[Puppetee]
[/Puppeteer]
[Webpage]
[/Webpage]
This code works but the file saved is broken. It's not the same result than what I get doing this
[Webpage]
[/Webpage]
Instead of blob.text() , I tryed FileReader.readAsText and FileReader.readAsBinaryString but I get the exact same problem : the file is saved but it's broken.
When I download the file using a.href, the file is correct , so I searched a way to modify the path of the folder where the files are downloaded. I need to get this file inside my project because I have to process it with ffmpeg after that and ffmpeg doesn't like absolute path...
I found someone on the internet who posted that code as a solution to my problem :
[Puppeteer]
await page._client.send('Page.setDownloadBehavior', {behavior: 'allow', downloadPath: './tmp'});
[/Puppeteer]
But after I'll add this line, the download of my file failed. Not good.
So I searched more and found that code based on puppeteer-extra
[Puppeteer]
[/Puppeteer]
But it doesn't work.................................
My file is downloaded inside the "download" folder of windows.
I do not know what to do now...
I thought saving a file was a common task but I tryed and tryed and tryed for almost 10 hours now ...
Here is how I launch Puppeteer just in case it helps you to help me :)
[Puppeteer]
[/Puppeteer]
and my package.json looks like this
[package.json]
[/package.json]
Please help me ! I'm becoming totally crazy !
The text was updated successfully, but these errors were encountered: