tus-metadata
v1.0.2
Published
Decode/encode Tus Upload-Metadata strings
Downloads
187
Maintainers
Readme
tus-metadata
Encode and decode Tus Upload-Metatada.
Install
npm install --save tus-metadata
Requires Node v6+
Usage
See ./test directory for usage examples.
decode(str)
Accepts an Upload-Metadata
encoded string and returns a key/value object.
encode(obj)
Accepts an object and returns an Upload-Metadata
encoded string.
import { encode, decode } from 'tus-metadata'
const str = 'filename d29ybGRfZG9taW5hdGlvbl9wbGFuLnBkZg==, mimetype dGV4dC9wbGFpbgo='
decode(str)
// => {filename: 'world_domination_plan.pdf', mimetype: 'text/plain'}
encode(decode(str))
// => filename d29ybGRfZG9taW5hdGlvbl9wbGFuLnBkZg==,mimetype dGV4dC9wbGFpbgo=