Instance of toPojo to use when serializing objects
Combined map of all SerializationFormat
and ImageFormat
entries to their respective MIME Types
Map of MIME Type to each ImageFormat
or SerializationFormat
.
Returns an instance of the ObjectId
constructor bson
node module, using the native bson-ext
if available.
Returns an EncodeTools instance with the default properties
Returns an instance of the bson
node module, using the native bson-ext
if available.
Adjust brightness of image
Image
Format to save result as
Adjust brightness of image
Image
Format to save result as
Adjust brightness of image
Image
Format to save result as
Adjust brightness of image
Image
Format to save result as
Adjust brightness of image
Image
Format to save result as
Adjust brightness of image
Image
Format to save result as
Compresses arbitrary data using the provided format and any options
Data to compress
Format to use
Options
Compresses arbitrary data using the provided format and any options
Data to compress
Format to use
Options
Compresses arbitrary data using the provided format and any options
Data to compress
Format to use
Options
Saves an image in the provided format, performing no operations on the image
Format to save result as
Saves an image in the provided format, performing no operations on the image
Format to save result as
Saves an image in the provided format, performing no operations on the image
Format to save result as
Saves an image in the provided format, performing no operations on the image
Format to save result as
Saves an image in the provided format, performing no operations on the image
Format to save result as
Saves an image in the provided format, performing no operations on the image
Image
Format to save result as
Crops an image and returns a Buffer containing the result in the provided format
Image
Height/Width to resize to
Format to save result as
Crops an image and returns a Buffer containing the result in the provided format
Image
Height/Width to resize to
Format to save result as
Crops an image and returns a Buffer containing the result in the provided format
Image
Height/Width to resize to
Format to save result as
Crops an image and returns a Buffer containing the result in the provided format
Image
Height/Width to resize to
Format to save result as
Crops an image and returns a Buffer containing the result in the provided format
Image
Height/Width to resize to
Format to save result as
Crops an image and returns a Buffer containing the result in the provided format
Image
Height/Width to resize to
Format to save result as
Decodes binary data from the provided format returning either a node.js buffer.
Decodes binary data from the provided format returning either a node.js buffer.
Decodes binary data from the provided format returning either a node.js buffer.
Decodes binary data from the provided format returning either a node.js buffer.
Decodes binary data from the provided format returning either a node.js buffer.
Decodes binary data from the provided format returning either a node.js buffer.
Decodes binary data from the provided format returning either a node.js buffer.
Decodes binary data from the provided format returning either a node.js buffer.
Decodes binary data from the provided format returning either a node.js buffer.
Decodes binary data from the provided format returning either a node.js buffer.
Decodes binary data from the provided format returning either a node.js buffer.
Decodes binary data from the provided format returning either a node.js buffer.
Decodes binary data from the provided format returning either a node.js buffer.
Decodes binary data from the provided format returning either a node.js buffer.
Decodes binary data from the provided format returning either a node.js buffer.
Decodes binary data from the provided format returning either a node.js buffer.
Decodes binary data from the provided format returning either a node.js buffer.
Decodes binary data from the provided format returning either a node.js buffer.
Decodes binary data from the provided format returning either a node.js buffer.
Decodes binary data from the provided format returning either a node.js buffer.
Decompresses arbitrary data using the provided format and any options
Data to decompress
Format to use
Decompresses arbitrary data using the provided format and any options
Data to decompress
Format to use
Decompresses arbitrary data using the provided format and any options
Data to decompress
Format to use
Deserializes an object serialized using one of the available algorithms, returning the result as an object
Data to deserialize
Algorithm to deserialize with
Deserializes an object serialized using one of the available algorithms, returning the result as an object
Data to deserialize
Algorithm to deserialize with
Deserializes an object serialized using one of the available algorithms, returning the result as an object
Data to deserialize
Algorithm to deserialize with
Deserializes an object serialized using one of the available algorithms, returning the result as an object
Data to deserialize
Algorithm to deserialize with
Deserializes an object serialized using one of the available algorithms, returning the result as an object
Data to deserialize
Algorithm to deserialize with
Deserializes an object serialized using one of the available algorithms, returning the result as an object
Data to deserialize
Algorithm to deserialize with
Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string
Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string
Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string
Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string
Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string
Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string
Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string
Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string
Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string
Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string
Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string
Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string
Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string
Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string
Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string
Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string
Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string
Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string
Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string
Encodes binary data using the provided format returning either a node.js buffer, array buffer, or string
Hashes data using the provided algorithm, returning a node.js Buffer.
Hashes an object using the provided algorithm, returning a node.js Buffer.
Hashes data using the provided algorithm, returning a node.js Buffer.
Extracts a SerializationFormat
or ImageFormat
from the specified HTTP header,
or defaults to the SerializationFormat
or Image Format
in the options of the encoder.
Extracts a ImageFormat
from the specified HTTP header,
or defaults to the Image Format
in the options of the encoder.
Extracts a SerializationFormat
from the specified HTTP header,
or defaults to the SerializationFormat
in the options of the encoder.
Resizes an image and returns a Buffer containing the result in the provided format
Image
Height/Width to resize to
Format to save result as
Resizes an image and returns a Buffer containing the result in the provided format
Image
Height/Width to resize to
Format to save result as
Resizes an image and returns a Buffer containing the result in the provided format
Image
Height/Width to resize to
Format to save result as
Resizes an image and returns a Buffer containing the result in the provided format
Image
Height/Width to resize to
Format to save result as
Resizes an image and returns a Buffer containing the result in the provided format
Image
Height/Width to resize to
Format to save result as
Resizes an image and returns a Buffer containing the result in the provided format
Image
Height/Width to resize to
Format to save result as
Serializes an object using one of the available algorithms, returning the result as a Buffer or a string
Object to serialize
Algorithm to serialize with
Use toPojo
on the object before serializing
If true, Buffers will be encoded with this.encodeBuffer
when encountered.
Serializes an object using one of the available algorithms, returning the result as a Buffer or a string
Object to serialize
Algorithm to serialize with
Use toPojo
on the object before serializing
If true, Buffers will be encoded with this.encodeBuffer
when encountered.
Serializes an object using one of the available algorithms, returning the result as a Buffer or a string
Object to serialize
Algorithm to serialize with
Use toPojo
on the object before serializing
If true, Buffers will be encoded with this.encodeBuffer
when encountered.
Serializes an object using one of the available algorithms, returning the result as a Buffer or a string
Object to serialize
Algorithm to serialize with
Use toPojo
on the object before serializing
If true, Buffers will be encoded with this.encodeBuffer
when encountered.
Serializes an object using one of the available algorithms, returning the result as a Buffer or a string
Object to serialize
Algorithm to serialize with
Use toPojo
on the object before serializing
If true, Buffers will be encoded with this.encodeBuffer
when encountered.
Serializes an object using one of the available algorithms, returning the result as a Buffer or a string
Object to serialize
Algorithm to serialize with
Use toPojo
on the object before serializing
If true, Buffers will be encoded with this.encodeBuffer
when encountered.
Generates a unique ID using one of the available algorithms, returning the result as a Buffer, string or number.
Algorithm to use to generate the unique id
Generates a unique ID using one of the available algorithms, returning the result as a Buffer, string or number.
Algorithm to use to generate the unique id
Generates a unique ID using one of the available algorithms, returning the result as a Buffer, string or number.
Algorithm to use to generate the unique id
Generates a unique ID using one of the available algorithms, returning the result as a Buffer, string or number.
Algorithm to use to generate the unique id
Generates a unique ID using one of the available algorithms, returning the result as a Buffer, string or number.
Algorithm to use to generate the unique id
Generates a unique ID using one of the available algorithms, returning the result as a Buffer, string or number.
Algorithm to use to generate the unique id
Generates a unique ID using one of the available algorithms, returning the result as a Buffer, string or number.
Algorithm to use to generate the unique id
Generates a unique ID using one of the available algorithms, returning the result as a Buffer, string or number.
Algorithm to use to generate the unique id
Extra args to pass to the ID generation function
Encodes an ArrayBuffer
to a node.js Buffer
using npm:typedarray-to-buffer, and
npm:Buffer if node.js Buffer is not available.
Encodes a base64 string to a node.js buffer.
Encodes a node.js buffer as a base32 string using npm:base32.js
Base32 string to decode.
Additional arguments to be passed to the Decoder
constructor
in npm:base32.js
Encodes a base64 string to a node.js buffer.
Encodes a base64url string to a node.js buffer.
Encodes a base64 string to a node.js buffer.
Hashes using bcrypt
Compares a password with bcrypt
Deserializes a BSON encoded Buffer to an object
BSON to deserialize
Deserializes a CBOR-encoded Buffer to an object
CBOR to deserialize
Compresses a buffer using LZMA
Buffer
Compression level (1-9)
Compresses a buffer using ZStd
Buffer
Compression level (1-9)
Creates an an EncodeTools instance with the provided properties
Returns options for @thirdact/to-pojo
with binary encoders set to the options in encode tools.
This produces POJOs with, for example, buffers encoded as base64
or ``base85`
Encoder to use
Binary encoding
Decodes a UUID encoded as a slugid returning the bytes as a Buffer
SlugID encoded UUID
Decompresses a buffer using LZMA
Buffer
Decompresses a buffer using ZStd
Buffer
Decodes a UUID encoded as a slugid returning the bytes as a Buffer
UUID as a Buffer
Always returns the provided data as a Buffer
, passing the data through Buffer.from
if not already a Buffer
Gets metadata of the image provided as a buffer
Image
Gets metadata of the image provided as a buffer
Image
Gets metadata of the image provided as a buffer
Image
Gets metadata of the image provided as a buffer
Image
Gets random bytes returning the result as a Buffer
Number of bytes to return
Decodes a hashids string, first to hex, then to a node.js buffer using npm:hashids.
Hashid string to decode
Additional arguments to be passed to the Hashids
constructor
in npm:hashids
Encodes a hexadecimal string to a node.js buffer.
Deserializes a JSON5 encoded string to an object
JSON5 to deserialize
Deserializes a JSON encoded string to an object
JSON to deserialize
Returns an instance of LZMA Native
Uses the very popular, but VERY VERY UNSAFE, MD5 cryptographic algorithm. Use SHA3 for new projects.
Uses 512bit SHA from node.js api
Deserializes a msgpack encoded Buffer to an object
msgpack to deserialize
Generates an ID using nanoid
Size of the id (in characters)
Creates a new ObjectId returning the bytes as a Buffer
Encodes a node.js Buffer
as an ArrayBuffer
using npm:Buffer if node.js Buffer is not available.
Encodes a node.js buffer as a base64 string.
Encodes a node.js buffer as a base32 string using npm:base32.js
Buffer to encode
Additional arguments to be passed to the Encoder
constructor
in npm:base32.js
Encodes a node.js buffer as a base64 string.
Encodes a node.js buffer as a base64url string.
Encodes a node.js buffer as a base64 string.
Encodes a hashids string, from a node.js buffer by first converting to hex and then using npm:hashids.
Additional arguments to be passed to the Hashids
constructor
in npm:hashids
Encodes a node.js buffer as a hexadecimal string.
Serializes data as BSON, returning the result as a Buffer
Object to serialize
Serializes an object as a CBOR-encoded Buffer
Object to serialize
Serializes data as a JSON encoded string
Object to serialize
Serializes data as a JSON5 encoded string
Object to serialize
Serializes data as msgpack, returning the result as a Buffer
Object to serialize
Attempts to load a module if available, or returns null
Uses the very popular, but UNSAFE, SHA-1 cryptographic algorithm. Use SHA3 for new projects.
Uses SHA1 from node.js api
Uses the popular, but UNSAFE, 512bit SHA-2 cryptographic algorithm. Use SHA3 for new projects.
Uses 512bit SHA from node.js api
Uses the new SHA-3 cryptographic algorithm.
Uses SHA-3 from npm:hash-wasm
Uses the popular, but UNSAFE, 512bit SHA- cryptographic algorithm. Use SHA3 for new projects.
Uses 512bit SHA from node.js api
Returns an instance of Sharp
Returns a JavaScript timestamp (in milliseconds)
Generates a v1 UUID, returning the bytes as a Buffer
Generates a v1 UUID, returning the bytes as an array of numbers
Generates a v1 UUID, returning the bytes as a hexadecimal string in the traditional format (with dashes "-").
Generates a v4 UUID, returning the bytes as a Buffer
Generates a v4 UUID, returning the bytes as an array of numbers
Generates a v4 UUID, returning the bytes as a hexadecimal string in the traditional format (with dashes "-").
Hashes using XXHash-3 (https://zb.gy/l4kN), a fast, non-cryptographic, hashing function.
Uses XXHash from npm:xxhash-addon
Hashes using XXHash-32 (https://zb.gy/l4kN), a fast, non-cryptographic, hashing function.
Uses XXHash from npm:xxhash-addon
Hashes using XXHash-64 (https://zb.gy/l4kN), a fast, non-cryptographic, hashing function.
Uses XXHash from npm:xxhash-addon
Returns an instance of XXHash Addon
Generated using TypeDoc
Contains tools for encoding/decoding data in different circumstances.
Will only attempt to use the native compiled npm libraries, returning an error if they aren't available. This class will not work in browsers.