51degrees / 51degrees.node Goto Github PK
View Code? Open in Web Editor NEWDEPRECATED: See 51Degrees/Device-Detection for latest Node.js API:
Home Page: https://github.com/51Degrees/Device-Detection/tree/master/node.js
DEPRECATED: See 51Degrees/Device-Detection for latest Node.js API:
Home Page: https://github.com/51Degrees/Device-Detection/tree/master/node.js
npm install 51degrees
results in an error with the latest io.js 3.0.0:
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(uint32_t)’:
../node_modules/nan/nan.h:772:61: error: could not convert ‘node::Buffer::New(v8::Isolate::GetCurrent(), ((size_t)size))’ from ‘v8::MaybeLocal<v8::Object>’ to ‘v8::Local<v8::Object>’
return node::Buffer::New(v8::Isolate::GetCurrent(), size);
^
As already noted here: 1ae3e3d production environments break right now.
Please check if the module is available and load it only if necessary (especially not in production envs).
Hello!
The compiling error was appeared when i try to install the package.
The os version - ubuntu 16.10
The node version - v.6.9.1
In file included from ../src/pattern/api.cc:33:0:
../node_modules/nan/nan.h: At global scope:
../node_modules/nan/nan.h:590:20: error: variable or field ‘AddGCEpilogueCallback’ declared void
v8::Isolate::GCEpilogueCallback callback
^~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:590:7: error: ‘GCEpilogueCallback’ is not a member of ‘v8::Isolate’
v8::Isolate::GCEpilogueCallback callback
^~
../node_modules/nan/nan.h:591:18: error: expected primary-expression before ‘gc_type_filter’
, v8::GCType gc_type_filter = v8::kGCTypeAll) {
^~~~~~~~~~~~~~
../node_modules/nan/nan.h:596:20: error: variable or field ‘RemoveGCEpilogueCallback’ declared void
v8::Isolate::GCEpilogueCallback callback) {
^~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:596:7: error: ‘GCEpilogueCallback’ is not a member of ‘v8::Isolate’
v8::Isolate::GCEpilogueCallback callback) {
^~
../node_modules/nan/nan.h:601:20: error: variable or field ‘AddGCPrologueCallback’ declared void
v8::Isolate::GCPrologueCallback callback
^~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:601:7: error: ‘GCPrologueCallback’ is not a member of ‘v8::Isolate’
v8::Isolate::GCPrologueCallback callback
^~
../node_modules/nan/nan.h:602:18: error: expected primary-expression before ‘gc_type_filter’
, v8::GCType gc_type_filter = v8::kGCTypeAll) {
^~~~~~~~~~~~~~
../node_modules/nan/nan.h:607:20: error: variable or field ‘RemoveGCPrologueCallback’ declared void
v8::Isolate::GCPrologueCallback callback) {
^~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:607:7: error: ‘GCPrologueCallback’ is not a member of ‘v8::Isolate’
v8::Isolate::GCPrologueCallback callback) {
^~
../node_modules/nan/nan.h: In function ‘bool Nan::SetAccessor(v8::Localv8::Object, v8::Localv8::String, Nan::GetterCallback, Nan::SetterCallback, v8::Localv8::Value,
v8::AccessControl, v8::PropertyAttribute)’:
../node_modules/nan/nan.h:1933:16: warning: ‘bool v8::Object::SetAccessor(v8::Localv8::Name, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::Localv8::Value, v8::AccessControl, v8::PropertyAttribute)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
, attribute);
^
In file included from /home/user/.node-gyp/6.9.1/include/node/v8.h:25:0,
from /home/user/.node-gyp/6.9.1/include/node/node.h:42,
from ../src/pattern/api.cc:31:
/home/user/.node-gyp/6.9.1/include/node/v8.h:2751:22: note: declared here
bool SetAccessor(Local name,
^
/home/user/.node-gyp/6.9.1/include/node/v8config.h:333:3: note: in definition of macro ‘V8_DEPRECATED’
declarator attribute((deprecated(message)))
^~~~~~~~~~
../src/pattern/api.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE PatternParser::Parse(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/pattern/api.cc:108:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (strlen(*v8_input) > maxInputLength) {
~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
pattern.target.mk:100: recipe for target 'Release/obj.target/pattern/src/pattern/api.o' failed
make: *** [Release/obj.target/pattern/src/pattern/api.o] Error 1
The TrieV3 data file is now marked as deprecated, but the new TrieV32 is not supported with current NodeJS bindings.
Warning: Device data file is not correct
We have a severe issue with the module as it breaks on JSON parsing sometimes:
SyntaxError: Unexpected token (
at Object.parse (native)
at Parser.parse (/51degrees-test/node_modules/51degrees/index.js:89:18)
at null.<anonymous> (/51degrees-test/index.js:19:16)
It is very simple to reproduce as you just need to throw this user agent string against (at least) Enterprise-DB and return the HardwareFamily: "Mozilla/5.0 (Linux; U; Android 4.2.2; en-us; KFTHWI Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Silk/3.30 like Chrome/34.0.1847.137 Safari/537.36"
"HardwareFamily": "Kindle Fire HDX 7" (3rd Gen)"
The data needs to be escaped in order to allow the parsing with JSON.parse for these cases.
I'm pretty sure it is quiet easy to fix but as I'm not familiar with C or C++ I can't patch it myself, sorry :(
remove exceed ws->profileCount > 0
operation
Are there anyway to load data to into memory? I can only get 7 req/s from my cloud server.
simply renaming api.c and api.h to 51Degrees.c and 51Degrees.h and pattern.cc to api.cc and pattern.h to api.h
it includes:
The new api will like:
var psr = new Parser('51D_filename.(dat|trie)');
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.