c4milo / fusejs Goto Github PK
View Code? Open in Web Editor NEWLow level fuse bindings for nodejs
Home Page: http://c4milo.github.io/fusejs
Low level fuse bindings for nodejs
Home Page: http://c4milo.github.io/fusejs
It could also be extracting that specific part of CK and statically compile it with the rest of the addon, as opposed to having the whole library as a dependency. Any thoughts @thejinx0r?
Consider this very basic example to illustrate what I mean.
List of Items to search through:
let list = [
"mr. h",
"mr. p",
"mr. m"
];
Search Term:
let searchTerm = "mr.h"
Notice that the search term is almost equivalent to the first result- the only difference is the missing space after the ".".
Running the search produces the following results:
const options = {
includeScore: false,
threshold: 0.7,
};
const fuse = new Fuse(list, options)
const result = fuse.search(searchTerm)
[
{
"item": "mr. h",
"refIndex": 0,
"score": 0.37526977437859277
},
{
"item": "mr. p",
"refIndex": 1,
"score": 0.37526977437859277
},
{
"item": "mr. m",
"refIndex": 2,
"score": 0.37526977437859277
}
]
I would expect the first item "mr. h" to have a higher score than the other 2, since it has only 1 character difference compared to the search query, while the others have two differences. However, all 3 scores are equal.
This behaviour only seems to be present when the list items are longer than the search query, and are identical up to the length of the search query, but have differences beyond that.
Is this expected behaviour? If so, could you explain why that's the case?
I see you need to reply to read
methods with a buffer containing all the data, won't that fail for files that are over 1.7GiB?
npm install fusejs
failed; because of deprecated node-waf
0 info it worked if it ends with ok
1 verbose cli [ '/Users/steveyang/.nvm/versions/io.js/v1.6.1/bin/iojs',
1 verbose cli '/Users/steveyang/.nvm/versions/io.js/v1.6.1/bin/npm',
1 verbose cli 'install',
1 verbose cli 'fusejs' ]
2 info using [email protected]
3 info using [email protected]
4 silly cache add args [ 'fusejs', null ]
5 verbose cache add spec fusejs
6 silly cache add parsed spec { raw: 'fusejs',
6 silly cache add scope: null,
6 silly cache add name: 'fusejs',
6 silly cache add rawSpec: '',
6 silly cache add spec: '*',
6 silly cache add type: 'range' }
7 verbose addNamed fusejs@*
8 silly addNamed semver.valid null
9 silly addNamed semver.validRange *
10 silly addNameRange { name: 'fusejs', range: '*', hasData: false }
11 silly mapToRegistry name fusejs
12 silly mapToRegistry using default registry
13 silly mapToRegistry registry https://registry.npmjs.org/
14 silly mapToRegistry uri https://registry.npmjs.org/fusejs
15 verbose addNameRange registry:https://registry.npmjs.org/fusejs not in flight; fetching
16 verbose request uri https://registry.npmjs.org/fusejs
17 verbose request no auth needed
18 info attempt registry request try #1 at 19:52:04
19 verbose request id cb6b2cd0e86903a3
20 verbose etag "AF6QL74HZBA57QQUJ6PBZUPAE"
21 http request GET https://registry.npmjs.org/fusejs
22 http 304 https://registry.npmjs.org/fusejs
23 silly get cb [ 304,
23 silly get { date: 'Mon, 23 Mar 2015 02:52:05 GMT',
23 silly get server: 'Apache',
23 silly get via: '1.1 varnish',
23 silly get 'last-modified': 'Mon, 23 Mar 2015 02:52:05 GMT',
23 silly get 'cache-control': 'max-age=60',
23 silly get etag: '"AF6QL74HZBA57QQUJ6PBZUPAE"',
23 silly get age: '0',
23 silly get 'x-served-by': 'cache-ord1734-ORD',
23 silly get 'x-cache': 'MISS',
23 silly get 'x-cache-hits': '0',
23 silly get 'x-timer': 'S1427079125.227905,VS0,VE38',
23 silly get vary: 'Accept',
23 silly get 'content-length': '0',
23 silly get 'keep-alive': 'timeout=10, max=50',
23 silly get connection: 'Keep-Alive' } ]
24 verbose etag https://registry.npmjs.org/fusejs from cache
25 verbose get saving fusejs to /Users/steveyang/.npm/registry.npmjs.org/fusejs/.cache.json
26 silly addNameRange number 2 { name: 'fusejs', range: '*', hasData: true }
27 silly addNameRange versions [ 'fusejs', [ '0.0.1-dev', '0.0.1' ] ]
28 verbose addNamed [email protected]
29 silly addNamed semver.valid 0.0.1
30 silly addNamed semver.validRange 0.0.1
31 silly cache afterAdd [email protected]
32 verbose afterAdd /Users/steveyang/.npm/fusejs/0.0.1/package/package.json not in flight; writing
33 verbose afterAdd /Users/steveyang/.npm/fusejs/0.0.1/package/package.json written
34 silly install resolved [ { name: 'fusejs',
34 silly install resolved version: '0.0.1',
34 silly install resolved author: { name: 'Camilo Aguilar - http://github.com/c4milo' },
34 silly install resolved email: '[email protected]',
34 silly install resolved description: 'Low level Fuse bindings for NodeJS.',
34 silly install resolved repositories: [ [Object] ],
34 silly install resolved devDependencies: { mocha: '0.14.1', should: '0.6.0' },
34 silly install resolved scripts: { install: 'make' },
34 silly install resolved main: './fuse',
34 silly install resolved _id: '[email protected]',
34 silly install resolved dist:
34 silly install resolved { shasum: '1d300bdc015197b4e69988d96578a7c4de6ce1c5',
34 silly install resolved tarball: 'http://registry.npmjs.org/fusejs/-/fusejs-0.0.1.tgz' },
34 silly install resolved _npmVersion: '1.1.63',
34 silly install resolved _npmUser: { name: 'c4milo', email: '[email protected]' },
34 silly install resolved maintainers: [ [Object] ],
34 silly install resolved directories: {},
34 silly install resolved _shasum: '1d300bdc015197b4e69988d96578a7c4de6ce1c5',
34 silly install resolved _resolved: 'https://registry.npmjs.org/fusejs/-/fusejs-0.0.1.tgz',
34 silly install resolved _from: 'fusejs@*',
34 silly install resolved repository: { type: 'git', url: 'http://github.com/c4milo/fusejs.git' },
34 silly install resolved bugs: { url: 'https://github.com/c4milo/fusejs/issues' },
34 silly install resolved readme: 'ERROR: No README data found!',
34 silly install resolved homepage: 'https://github.com/c4milo/fusejs' } ]
35 info install [email protected] into /private/tmp/fe
36 info installOne [email protected]
37 verbose installOne of fusejs to /private/tmp/fe not in flight; installing
38 verbose lock using /Users/steveyang/.npm/_locks/fusejs-33444705d2998d8f.lock for /private/tmp/fe/node_modules/fusejs
39 silly install write writing fusejs 0.0.1 to /private/tmp/fe/node_modules/fusejs
40 silly cache addNamed cb [email protected]
41 verbose unbuild node_modules/fusejs
42 verbose gentlyRm vacuuming /private/tmp/fe/node_modules/fusejs
43 verbose tar unpack /Users/steveyang/.npm/fusejs/0.0.1/package.tgz
44 verbose tar unpacking to /private/tmp/fe/node_modules/fusejs
45 verbose gentlyRm vacuuming /private/tmp/fe/node_modules/fusejs
46 silly gunzTarPerm modes [ '755', '644' ]
47 silly gunzTarPerm extractEntry package.json
48 silly gunzTarPerm extractEntry .npmignore
49 silly gunzTarPerm extractEntry README.md
50 silly gunzTarPerm extractEntry fuse.js
51 silly gunzTarPerm extractEntry examples/loopback.js
52 silly gunzTarPerm extractEntry examples/loopback_main.js
53 silly gunzTarPerm extractEntry Makefile
54 silly gunzTarPerm extractEntry spec/fuse.spec.js
55 silly gunzTarPerm extractEntry src/filesystem.h
56 silly gunzTarPerm extractEntry src/bindings.cc
57 silly gunzTarPerm extractEntry src/file_info.cc
58 silly gunzTarPerm extractEntry src/file_info.h
59 silly gunzTarPerm extractEntry src/filesystem.cc
60 silly gunzTarPerm extractEntry src/bindings.h
61 silly gunzTarPerm extractEntry src/node_fuse.cc
62 silly gunzTarPerm extractEntry src/node_fuse.h
63 silly gunzTarPerm extractEntry src/reply.cc
64 silly gunzTarPerm extractEntry src/reply.h
65 silly gunzTarPerm extractEntry src/wscript
66 silly gunzTarPerm extractEntry wscript
67 info preinstall [email protected]
68 silly install resolved []
69 verbose about to build /private/tmp/fe/node_modules/fusejs
70 info build /private/tmp/fe/node_modules/fusejs
71 verbose linkStuff [ false, false, false, '/private/tmp/fe/node_modules' ]
72 info linkStuff [email protected]
73 verbose linkBins [email protected]
74 verbose linkMans [email protected]
75 verbose rebuildBundles [email protected]
76 info install [email protected]
77 verbose unsafe-perm in lifecycle true
78 info [email protected] Failed to exec install script
79 verbose unlock done using /Users/steveyang/.npm/_locks/fusejs-33444705d2998d8f.lock for /private/tmp/fe/node_modules/fusejs
80 verbose stack Error: [email protected] install: `make`
80 verbose stack Exit status 2
80 verbose stack at EventEmitter.<anonymous> (/Users/steveyang/.nvm/versions/io.js/v1.6.1/lib/node_modules/npm/lib/utils/lifecycle.js:213:16)
80 verbose stack at emitTwo (events.js:87:13)
80 verbose stack at EventEmitter.emit (events.js:169:7)
80 verbose stack at ChildProcess.<anonymous> (/Users/steveyang/.nvm/versions/io.js/v1.6.1/lib/node_modules/npm/lib/utils/spawn.js:14:12)
80 verbose stack at emitTwo (events.js:87:13)
80 verbose stack at ChildProcess.emit (events.js:169:7)
80 verbose stack at maybeClose (child_process.js:984:16)
80 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1057:5)
81 verbose pkgid [email protected]
82 verbose cwd /private/tmp/fe
83 error Darwin 13.4.0
84 error argv "/Users/steveyang/.nvm/versions/io.js/v1.6.1/bin/iojs" "/Users/steveyang/.nvm/versions/io.js/v1.6.1/bin/npm" "install" "fusejs"
85 error node v1.6.1
86 error npm v2.7.1
87 error code ELIFECYCLE
88 error [email protected] install: `make`
88 error Exit status 2
89 error Failed at the [email protected] install script 'make'.
89 error This is most likely a problem with the fusejs package,
89 error not with npm itself.
89 error Tell the author that this fails on your system:
89 error make
89 error You can get their info via:
89 error npm owner ls fusejs
89 error There is likely additional logging output above.
90 verbose exit [ 1, true ]
91 verbose unbuild node_modules/fusejs
92 info preuninstall [email protected]
93 info uninstall [email protected]
94 verbose unbuild rmStuff [email protected] from /private/tmp/fe/node_modules
95 info postuninstall [email protected]
96 verbose gentlyRm vacuuming /private/tmp/fe/node_modules/fusejs
97 silly gentlyRm purging /private/tmp/fe/node_modules/fusejs
98 silly gentlyRm quitting because other entries in /private/tmp/fe/node_modules
Hi c4milo,
I liked the idea of using the fuse low-level api (especially with the asynchronous api) with nodeJS.
The code you had written was not working, and there are several issues suggesting a rewrite is needed.
I've made some minor (or maybe major?) modifications to it and it now works. If anyone is interested, have a look at https://github.com/thejinx0r/fusejs/tree/dev. The performance is great because fuse can run in multithreaded mode and the developer does not need to worry about that on the JS side!
I was thinking of releasing the changes back to the public, and I was wondering how should I proceed?
Should I create a new package and acknowledge your work, or create a pull request and merge the code in?
I haven't enabled all the functions yet, but it should be straightforward to get everything to work.
Eric
With:
node -v
v0.12.7
uname -a
Darwin Mbp 12.6.0 Darwin Kernel Version 12.6.0: Wed Mar 18 16:23:48 PDT 2015; root:xnu-2050.48.19~1/RELEASE_X86_64 x86_64
npm install fusejs -S
\
> [email protected] install /www/core/node_modules/fusejs
> node-gyp rebuild
CXX(target) Release/obj.target/fusejs/src/bindings.o
CXX(target) Release/obj.target/fusejs/src/file_info.o
CXX(target) Release/obj.target/fusejs/src/filesystem.o
../src/filesystem.cc:254:18: error: no member named 'forget_multi' in 'fuse_lowlevel_ops'
fuse_ops.forget_multi = FileSystem::MultiForget;
~~~~~~~~ ^
1 error generated.
make: *** [Release/obj.target/fusejs/src/filesystem.o] Error 1
Any ideas why?
Does this library support windows?
It should be also a reference implementation of file systems in nodejs using the low level API.
Some links:
http://code.google.com/p/macfuse/wiki/REFERENCE_FILE_SYSTEM
https://github.com/osxfuse/filesystems/blob/master/filesystems-c/loopback/loopback.c
Please, for the love of all things holy update the docs so that I don't have to go reading through .cc files or your gdrive implementation to figure out how this works!!!
Seriously, awesome work, thanks :) Docs would be nice though ๐ธ
I think a great first step would be just the reply object.
For more information, please refer to:
https://groups.google.com/forum/#!topic/v8-users/6kSAbnUb-rQ
I've tried a few different configurations.
OS tried: Mac OSX 10.7.5, and 10.11.1,
node versions tried: iojs 3.3.1, node 0.12.5, and node 5.0.0.
osxfuse tried: osxfuse 2.7.5 and 2.8.2.
Running pkg-config 0.29
Doesn't seem to matter the configuration.
> [email protected] install /Users/ecchi/Code/node_modules/fusejs
> node-gyp rebuild
CXX(target) Release/obj.target/fusejs/src/bindings.o
CXX(target) Release/obj.target/fusejs/src/file_info.o
CXX(target) Release/obj.target/fusejs/src/filesystem.o
CXX(target) Release/obj.target/fusejs/src/node_fuse.o
CXX(target) Release/obj.target/fusejs/src/reply.o
CXX(target) Release/obj.target/fusejs/src/forget_data.o
../src/forget_data.cc:40:85: error: member access into incomplete type 'struct fuse_forget_data'
info.GetReturnValue().Set( Nan::New<Integer>(static_cast<uint32_t>(forget_data->fd->ino)));
^
../src/forget_data.h:19:20: note: forward declaration of 'NodeFuse::fuse_forget_data'
struct fuse_forget_data *fd;
^
../src/forget_data.cc:40:87: error: expected ')'
info.GetReturnValue().Set( Nan::New<Integer>(static_cast<uint32_t>(forget_data->fd->ino)));
^
../src/forget_data.cc:40:69: note: to match this '('
info.GetReturnValue().Set( Nan::New<Integer>(static_cast<uint32_t>(forget_data->fd->ino)));
^
../src/forget_data.cc:47:86: error: member access into incomplete type 'struct fuse_forget_data'
info.GetReturnValue().Set( Nan::New<Integer>( static_cast<uint32_t>(forget_data->fd->nlookup)) );
^
../src/forget_data.h:19:20: note: forward declaration of 'NodeFuse::fuse_forget_data'
struct fuse_forget_data *fd;
^
../src/forget_data.cc:47:88: error: expected ')'
info.GetReturnValue().Set( Nan::New<Integer>( static_cast<uint32_t>(forget_data->fd->nlookup)) );
^
../src/forget_data.cc:47:70: note: to match this '('
info.GetReturnValue().Set( Nan::New<Integer>( static_cast<uint32_t>(forget_data->fd->nlookup)) );
^
4 errors generated.
make: *** [Release/obj.target/fusejs/src/forget_data.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 15.0.0
gyp ERR! command "/usr/local/bin/iojs" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/ecchi/Code/node_modules/fusejs
gyp ERR! node -v v3.3.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/bin/iojs" "/usr/local/bin/npm" "install" "fusejs"
npm ERR! node v3.3.1
npm ERR! npm v2.14.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the fusejs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls fusejs
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/ecchi/Code/npm-debug.log
This would help newcomers to get an idea of where it is being used any how it is used.
The MPSC queue is not thread safe on armv7 which either leads to a segmentation fault or a corrupted ring buffer.
I need to fuzzy search a tree of items. Each item may have some children (item.children
), and each child could be an item itself. It can be a recursive thing.
Is there a way to use fusejs for that?
The second line of the readme has a button to the Gutter chat, but the svg isn't loading. The issue is the space in the link to the svg. The correct second line is: [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/c4milo/fusejs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
The space needs to be replaced with a %20
in the https://badges.gitter.im/Join Chat.svg
link.
@thejinx0r -- I realize this isn't released, but since you're the only one actively contributing to this project, I'm hoping you can help. I get a slew of build errors with your most recent git push, all about template name mis-matches:
CXX(target) Release/obj.target/fusejs/src/bindings.o
../src/bindings.cc:7:5: error: no template named 'NanPersistent'; did you mean 'Persistent'?
NanPersistent<FunctionTemplate> Fuse::constructor_template;
^~~~~~~~~~~~~
Persistent
/Users/mark/.node-gyp/2.4.0/deps/v8/include/v8.h:616:45: note: 'Persistent' declared here
template<class F1, class F2> friend class Persistent;
^
../src/bindings.cc:10:12: error: no template named 'NanPersistent'; did you mean 'Persistent'?
static NanPersistent<String> filesystem_sym;
^~~~~~~~~~~~~
Persistent
/Users/mark/.node-gyp/2.4.0/deps/v8/include/v8.h:616:45: note: 'Persistent' declared here
template<class F1, class F2> friend class Persistent;
^
../src/bindings.cc:11:12: error: no template named 'NanPersistent'; did you mean 'Persistent'?
static NanPersistent<String> options_sym;
^~~~~~~~~~~~~
Persistent
... another 20 errors
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.