The "path" argument must be one of type string, Buffer, or URL. Received type boolean
See original GitHub issueHi @BlueHatbRit,
I was trying to generate a PDF file with your module with the programmatic API and I would like to keep the generated temporary HTML file (passed the debug: true
to the options object). When the program is executed I get the error message mentioned in the title. I was using the following code (this example code is from the README):
const mdpdf = require('mdpdf');
const path = require('path');
let options = {
source: path.join(__dirname, 'README.md'),
destination: path.join(__dirname, 'output.pdf'),
debug: true,
pdf: {
border : {
top: "20mm",
left: "20mm",
right: "20mm",
bottom: "20mm"
},
format: 'A4',
orientation: 'portrait'
}
};
mdpdf.convert(options).then((pdfPath) => {
console.log('PDF Path:', pdfPath);
}).catch((err) => {
console.error(err);
});
This is the full output of the program:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be one of type string, Buffer, or URL. Received type boolean
at Object.open (fs.js:408:3)
at WriteStream.open (internal/fs/streams.js:267:12)
at new WriteStream (internal/fs/streams.js:254:10)
at Object.createWriteStream (fs.js:1731:10)
at writeFile.then.then.then.then.then.then (C:\wamp64\www\pdf\node_modules\mdpdf\src\index.js:199:51)
at tryCatcher (C:\wamp64\www\pdf\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\wamp64\www\pdf\node_modules\bluebird\js\release\promise.js:512:31)
at Promise._settlePromise (C:\wamp64\www\pdf\node_modules\bluebird\js\release\promise.js:569:18)
at Promise._settlePromise0 (C:\wamp64\www\pdf\node_modules\bluebird\js\release\promise.js:614:10)
at Promise._settlePromises (C:\wamp64\www\pdf\node_modules\bluebird\js\release\promise.js:694:18)
at _drainQueueStep (C:\wamp64\www\pdf\node_modules\bluebird\js\release\async.js:138:12)
at _drainQueue (C:\wamp64\www\pdf\node_modules\bluebird\js\release\async.js:131:9)
at Async._drainQueues (C:\wamp64\www\pdf\node_modules\bluebird\js\release\async.js:147:5)
at Immediate.Async.drainQueues [as _onImmediate] (C:\wamp64\www\pdf\node_modules\bluebird\js\release\async.js:17:14)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
Despite of the error message, every file is generated (even the _temp.html)
Can you take a look?
Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
fs.FileRead -> TypeError [ERR_INVALID_ARG_TYPE]: The ...
When I open file, "TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be one of type string, Buffer, or URL. Received type undefined" ...
Read more >Uncaught The "path" argument must be one of type string, Buffer, or ...
Uncaught The "path" argument must be one of type string, Buffer, or URL. ... Received type boolean at Object.fs.open (fs.js:555:3) at Object.module.
Read more >[Fix] TypeError [ERR_INVALID_ARG_TYPE]: The “path ...
Have you run into the error “TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string. Received undefined”? In this story I'll go...
Read more >typeerror [err_invalid_arg_type]: the "path" argument must be ...
When I open file, "TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be one of type string, Buffer, or URL. Received type undefined" .
Read more >The first argument must be of type string or an instance of ...
Coding example for the question [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer. when using admin.auth().
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @enisz, so sorry for the delay. The weekend was very busy and I unfortunately can only maintain this in my spare time.
I’ve just had a look and it would seem the documentation example is out of date which is really awful, so sorry! The
debug
option should actually be the path you wish to save the html debug file.I hope this hasn’t delayed you too much. I’m going to update the documentation now.
Sounds like a great use of mdpdf! Good to know people are using the api as well, I thought most people just used the cli. Do feel free to send PR’s or put in feature suggestions, I don’t get a huge amount of time for it these days but I’m always looking to improve the project when I can.
Thanks for sharing the details 😃