Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated to work under Node.js v12 #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# quoted-printable
Fast, robust RFC 2045 (Quoted-Printable) and RFC 2047 (Q-Encoding) encoder/decoder for Buffers in pure Javascript with an optional C++ binding. Avoids intermediary string allocations and regular expressions. Reduces branching through the use of lookup tables.
Fast, robust RFC 2045 (Quoted-Printable) and RFC 2047 (Q-Encoding) encoder/decoder for Buffers in pure Javascript with an optional C++ binding. Avoids intermediary string allocations and regular expressions. Reduces branching through the use of lookup tables. This is a fork of [@ronomon/quoted-printable](https://github.com/ronomon/quoted-printable/) modified to support Node.js v12.

## Installation

#### Linux, OS X
This will compile the native binding automatically:
```
npm install @ronomon/quoted-printable
npm install @vlasky/quoted-printable
```

#### Windows
This will skip compiling the native binding automatically:
```
npm install --ignore-scripts @ronomon/quoted-printable
npm install --ignore-scripts @vlasky/quoted-printable
```

## Performance
Expand Down Expand Up @@ -75,21 +75,21 @@ npm install --ignore-scripts @ronomon/quoted-printable
```

## Native Binding (Optional)
The native binding will be installed automatically when installing `@ronomon/quoted-printable` without the `--ignore-scripts` argument. The Javascript binding will be used if the native binding could not be compiled or is not available. To compile the native binding manually after installing, install [node-gyp](https://www.npmjs.com/package/node-gyp) globally:
The native binding will be installed automatically when installing `@vlasky/quoted-printable` without the `--ignore-scripts` argument. The Javascript binding will be used if the native binding could not be compiled or is not available. To compile the native binding manually after installing, install [node-gyp](https://www.npmjs.com/package/node-gyp) globally:
```
sudo npm install node-gyp -g
```
Then build the binding from within the `@ronomon/quoted-printable` module directory:
Then build the binding from within the `@vlasky/quoted-printable` module directory:
```
cd node_modules/@ronomon/quoted-printable
cd node_modules/@vlasky/quoted-printable
node-gyp rebuild
```

## Usage

#### Encoding
```javascript
var QuotedPrintable = require('@ronomon/quoted-printable');
var QuotedPrintable = require('@vlasky/quoted-printable');
var string = ' = ';
var options = { qEncoding: false };
var buffer = Buffer.from(string, 'utf-8');
Expand All @@ -100,7 +100,7 @@ console.log(bufferEncoded.toString('ascii'));

#### Decoding
```javascript
var QuotedPrintable = require('@ronomon/quoted-printable');
var QuotedPrintable = require('@vlasky/quoted-printable');
var string = ' =3D=20';
var options = { qEncoding: false };
var bufferEncoded = Buffer.from(string, 'ascii');
Expand Down
4 changes: 2 additions & 2 deletions binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ NAN_METHOD(decode) {
}
v8::Local<v8::Object> sourceHandle = info[0].As<v8::Object>();
v8::Local<v8::Object> targetHandle = info[1].As<v8::Object>();
const uint8_t qEncoding = info[2]->Uint32Value();
const uint8_t qEncoding = info[2]->Uint32Value(Nan::GetCurrentContext()).FromJust();
v8::Local<v8::Object> tableDecodingHandle = info[3].As<v8::Object>();
v8::Local<v8::Object> tableLegalHandle = info[4].As<v8::Object>();
const uint32_t sourceLength = node::Buffer::Length(sourceHandle);
Expand Down Expand Up @@ -216,7 +216,7 @@ NAN_METHOD(encode) {
}
v8::Local<v8::Object> sourceHandle = info[0].As<v8::Object>();
v8::Local<v8::Object> targetHandle = info[1].As<v8::Object>();
const uint8_t qEncoding = info[2]->Uint32Value();
const uint8_t qEncoding = info[2]->Uint32Value(Nan::GetCurrentContext()).FromJust();
v8::Local<v8::Object> tableEncodingHandle = info[3].As<v8::Object>();
v8::Local<v8::Object> tableLiteralsHandle = info[4].As<v8::Object>();
const uint32_t sourceLength = node::Buffer::Length(sourceHandle);
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ronomon/quoted-printable",
"name": "@vlasky/quoted-printable",
"version": "3.2.1",
"description": "Fast, robust RFC 2045 (Quoted-Printable) and RFC 2047 (Q-Encoding) encoder/decoder for Buffers in pure Javascript with an optional C++ binding.",
"description": "Fast, robust RFC 2045 (Quoted-Printable) and RFC 2047 (Q-Encoding) encoder/decoder for Buffers in pure Javascript with an optional C++ binding. A fork of @ronomon/quoted-printable that supports Node.js v12.",
"main": "index.js",
"files": [
"benchmark.js",
Expand All @@ -12,7 +12,7 @@
],
"repository": {
"type": "git",
"url": "git+https://github.com/ronomon/quoted-printable.git"
"url": "git+https://github.com/vlasky/quoted-printable.git"
},
"keywords": [
"quoted-printable",
Expand All @@ -26,13 +26,13 @@
"bugs": {
"url": "https://github.com/ronomon/quoted-printable/issues"
},
"homepage": "https://github.com/ronomon/quoted-printable#readme",
"homepage": "https://github.com/vlasky/quoted-printable#readme",
"scripts": {
"postinstall": "node-gyp clean",
"test": "node test.js"
},
"dependencies": {
"@ronomon/queue": "^3.0.0",
"nan": "^2.10.0"
"nan": "^2.14.0"
vlasky marked this conversation as resolved.
Show resolved Hide resolved
}
}