Closed rolanday closed 5 years ago
The updated readme sample for the 2.x to 3.x change has two issues:
stat
stats
const {path, stat: {size}} = entry; // wrong const {path, stats: {size}} = entry; // correct
alwaysStat
true
so, like this instead...
const readdirp = require('readdirp'); readdirp('.', { alwaysStat: true, }) .on('data', (entry) => { const {path, stats: {size}} = entry; console.log(`${JSON.stringify({path, size})}`); }) // Optionally call stream.destroy() in `warn()` in order to abort and cause 'close' to be emitted .on('warn', error => console.error('non-fatal error', error)) .on('error', error => console.error('fatal error', error)) .on('end', () => console.log('done'));
The updated readme sample for the 2.x to 3.x change has two issues:
stat
tostats
.alwaysStat
option totrue
as per the change log comments.so, like this instead...