|
|
6 days ago | |
|---|---|---|
| .. | ||
| index.js | 6 days ago | |
| license | 6 days ago | |
| package.json | 6 days ago | |
| readme.md | 6 days ago | |
Ensure a path doesn't contain null bytes
The same check as done in all the core fs methods.
$ npm install --save null-check
var nullCheck = require('null-check');
nullCheck('unicorn.png\u0000', function (err) {
console.log(err);
//=> { [Error: Path must be a string without null bytes.] code: 'ENOENT' }
});
//=> false
// the method is sync without a callback
nullCheck('unicorn.png');
//=> true
MIT © Sindre Sorhus