Walk thougn the Current Dir by Rust crate(ignore)
Why
- f.f.f.f..f.f..ff...f.ff.f..fast
Use
const files = require('find-files-rust').find('./');
Demo
npm run start
see Result
[ './',
'./Cargo.toml',
'./cli-demo.js',
'./index.js',
'./readme.md',
'./yarn.lock',
'./package-lock.json',
'./package.json',
'./rust-dylib',
'./rust-dylib/libfind_files.dylib',
'./src',
'./src/lib.rs' ]
cost time: 0.009000000000000008 s
Build
cargo build --release
cp dylib into the dir named in package.json
and index.js
cp target/release/libfind_files.dylib ./rust-dylib
var lib = ffi.Library(path.join(__dirname, './rust-dylib/libfind_files'), {
find_files: ['char *', ['string']],
free_memory: ['void', ['char *']]
});
Use by