mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-29 17:07:07 +08:00
* commit 'Update `klaw-sync` module interface to v2.0.0 + [v2.0.0 apis](https://github.com/manidlou/node-klaw-sync/tree/v2.0.0) [v3.0.2 apis](https://github.com/manidlou/node-klaw-sync/tree/v3.0.2) * Update `klaw-sync` module interface from v1.0 to v2.0.0 + * Update `klaw-sync` module interface from v1.0 to v2.0.0 + * Change `klaw-sync` types version from `3.0` to `2.0` and remove ignore parameter. * Update test case. * Improve the test case of `options.filter`. * Add definitions of `klaw-sync` * Remove `Colin Luo` from `klaw-sync` Difinitions.
24 lines
571 B
TypeScript
24 lines
571 B
TypeScript
import * as path from 'path'
|
|
import klawSync = require('klaw-sync')
|
|
|
|
const outputMessage = (result: klawSync.Item) => {
|
|
console.log(`file: ${result.path} has size '${result.stats.size}'`)
|
|
}
|
|
|
|
klawSync('/some/dir').forEach(outputMessage)
|
|
|
|
const defaultOptions = {}
|
|
|
|
klawSync('/some/dir', defaultOptions).forEach(outputMessage)
|
|
|
|
const options = {
|
|
nodir: true,
|
|
nofile: false,
|
|
noRecurseOnFailedFilter: false,
|
|
filter(item: klawSync.Item) {
|
|
return item.path.indexOf('node_modules') < 0
|
|
},
|
|
}
|
|
|
|
klawSync('/some/dir', options).forEach(outputMessage)
|