1.0.0 • Published 3 years ago

@dwebcore/ddrive-promise v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

ddrive-promise

An async/await based wrapper for ddrive (v5+)

Install

$ npm install @dwebcore/ddrive-promise

Usage

ddrive-promise its totally API compatible with ddrive v5+. It's only a promise based wrapper.

E.g.:

const ddrive = require('@dwebcore/ddrive-promise')
const archive = ddrive('./my-first-ddrive') // content will be stored in this folder

try {
  await archive.writeFile('/hello.txt', 'world')
  const list = await archive.readdir('/')
  console.log(list) // prints ['hello.txt']
  const data = await archive.readFile('/hello.txt', 'utf-8')
  console.log(data) // prints 'world'
} catch (err) {
  console.log(err)
  // deal with the err
}