snappyjs
Advanced tools
Comparing version 0.6.0 to 0.6.1
{ | ||
"name": "snappyjs", | ||
"main": "./dist/snappyjs.js", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"homepage": "https://github.com/zhipeng-jia/snappyjs", | ||
@@ -6,0 +6,0 @@ "authors": [ |
11
index.js
@@ -121,2 +121,13 @@ // The MIT License (MIT) | ||
} | ||
if (!compressed.slice) { // ie11 | ||
var compressedArray = new Uint8Array(Array.prototype.slice.call(compressed, 0, length)) | ||
if (uint8Mode) { | ||
return compressedArray | ||
} else if (arrayBufferMode) { | ||
return compressedArray.buffer | ||
} else { | ||
throw new Error('Not implemented') | ||
} | ||
} | ||
return compressed.slice(0, length) | ||
@@ -123,0 +134,0 @@ } |
{ | ||
"name": "snappyjs", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "JavaScript implementation of Google's Snappy compression library", | ||
@@ -12,3 +12,2 @@ "repository": "zhipeng-jia/snappyjs", | ||
"license": "MIT", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
@@ -19,8 +18,8 @@ "benchmark": "~2.1.4", | ||
"licensify": "~3.1.3", | ||
"microtime": "~2.1.5", | ||
"microtime": "~3.0.0", | ||
"request-promise": "~4.2.1", | ||
"snappy": "~6.0.0", | ||
"snappy": "~6.3.5", | ||
"standard": "~10.0.2", | ||
"tap": "~10.5.1", | ||
"uglifyify": "~4.0.1" | ||
"tap": "^15.0.9", | ||
"uglifyify": "^5.0.2" | ||
}, | ||
@@ -40,3 +39,6 @@ "keywords": [ | ||
] | ||
}, | ||
"tap": { | ||
"check-coverage": false | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# SnappyJS [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) [![Travis CI status](https://travis-ci.org/zhipeng-jia/snappyjs.svg?branch=master)](https://travis-ci.org/zhipeng-jia/snappyjs) | ||
# SnappyJS [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) ![Node.js CI](https://github.com/zhipeng-jia/snappyjs/actions/workflows/test.yml/badge.svg) | ||
A pure JavaScript implementation of Google's [Snappy](https://github.com/google/snappy) compression library. | ||
@@ -20,3 +20,5 @@ | ||
SnappyJS works with Node.js 4.x or later. | ||
### Node.js | ||
SnappyJS works with Node.js 10.x or later. | ||
~~~javascript | ||
@@ -30,5 +32,16 @@ var SnappyJS = require('snappyjs') | ||
### Browser | ||
You can also use SnappyJS in browser. Adding `dist/snappyjs.js` or `dist/snappyjs.min.js` will introduce `SnappyJS` in the global scope. | ||
SnappyJS relies on `ArrayBuffer`. All major browsers support it now ([http://caniuse.com/#feat=typedarrays](http://caniuse.com/#feat=typedarrays)). Also, as I tested, SnappyJS has high performance on latest version of Google Chrome, Safari, Firefox, and Microsoft Edge. | ||
**When using webpack to build your project**, and you plan to only use `ArrayBuffer` or `Uint8Array` as input parameters, make sure to put the following in your webpack config to prevent it from automatically bundling a `Buffer` polyfill: | ||
```js | ||
node: { | ||
Buffer: false, | ||
} | ||
``` | ||
## API | ||
@@ -35,0 +48,0 @@ |
61661
14
477
99