possify
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Possify

test('buffer', async t => {
  const readFile = possify(util.promisify(fs.readFile))
  const index = await readFile('./index.js', {})
  t.is(true, Buffer.isBuffer(index))
})

test('string', async t => {
  const readFile = possify(util.promisify(fs.readFile))
  const index = await readFile('./index.js', { encoding: 'utf8' })
  t.is(true, typeof index === 'string')
})

test('error', async t => {
  const readFile = possify(util.promisify(fs.readFile))
  const error = await readFile('./zzz.js', { encoding: 'utf8' })
  t.is(true, error instanceof Error)
})

Readme

Keywords

none

Package Sidebar

Install

npm i possify

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

67.3 kB

Total Files

12

Last publish

Collaborators

  • mattmueller