find-files-rust
v2.1.1
Published
use Rust crate (ignore), walk though Current Dir
Downloads
5
Readme
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
- Rust, lib.rs with
libc
cargo build --release
cp dylib into the dir named in package.json
and index.js
cp target/release/libfind_files.dylib ./rust-dylib
- Node, index.js with
node-ffi
var lib = ffi.Library(path.join(__dirname, './rust-dylib/libfind_files'), {
find_files: ['char *', ['string']],
free_memory: ['void', ['char *']]
});