1.0.4 • Published 4 years ago

array-compression v1.0.4

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

Array Compression

Installation

npm install array-compression

Available Methods

MethodDescription
create_1dCreates a 1-Dimensional array
create_2dCreates a 2-Dimensional array
create_3dCreates a 3-Dimensional array
compressCompresses an array along with its metadata (optional)
uncompressUncompresses the array to its original form

Usage

const array = require("array-compression");

Creating a 1D array

Expected input : Array Size. The value field is optional, it can be an integer, string or list, if not provided an array will be populated with the default value - 0

size = INT
Value = (Optional)
array.create_1d(size, Value)

Creating a 2D array

Expected input : Height (x) and Width (y) of the array. The value field is optional, it can be an integer, string or list, if not provided an array will be populated with the default value - 0

height = INT
width = INT
Value = (Optional)
array.create_2d(height, width, Value)

Creating a 3D array

Expected input : Length (z), height (x) and Width (y) of the array. The value field is optional, it can be an integer, string or list, if not provided an array will be populated with the default value - 0

height = INT
width = INT
Value = (Optional)
array.create_3d(length, height, width, Value)

Compressing an Array

let input = array.create_3d(3, 2, 1);
let metadata = { test: "dummy data" }; // Optional field
array.compress(input, metadata).then(result => {
  // returns an Array buffer
});

Uncompressing an Array

input = ARRAYBUFFER generated using the compress method
array.uncompress(input).then(uncompressed_data => {
   /* returns 
   {
      data: contains the uncompressed array
      metadata: contains the associated metadata
   }
   */
});

License

MIT

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago