Socket
Socket
Sign inDemoInstall

any2buffer

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    any2buffer

Pass anything, get Node buffer back


Version published
Maintainers
1
Created

Readme

Source

any2buffer NPM version js-standard-style

Pass anything, get Node buffer back

  • Note - If no type is passed and we can't guess the type we'll use fs to see if it's a file path. Obviously this will affect performance, so if you know what type it will be or it is something we can assert (base64 or hex) then you can avoid touching the file system.

install

$ npm install --save any2buffer

api

  • dataToConvertToBuffer (anything - required)
  • dataType (string - optional) [ex. 'binary', 'base64', 'path', etc...]

usage

const any2buffer = require('any2buffer')
const doSomethingWithBuffer = (buf) => console.log(buf.toString('utf8'))

any2buffer('hello').then(doSomethingWithBuffer).catch(console.error)

License

MIT © Andrew Carpenter

Keywords

FAQs

Last updated on 13 Jan 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc