tus-metadata

1.0.2 • Public • Published

tus-metadata

Build Status

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=

Dependents (2)

Package Sidebar

Install

npm i tus-metadata

Weekly Downloads

42

Version

1.0.2

License

MIT

Last publish

Collaborators

  • olalonde