@wrote/read
Read the contents of file from the filesystem.
Last updated 2 years ago by zvr .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @wrote/read 
SYNC missed versions from official npm registry.

@wrote/read

npm version

@wrote/read is a package to read a file as a string or a Buffer.

yarn add -E @wrote/read

Table Of Contents

API

The package is available by importing its default function read, and named function readBuffer:

import read, { readBuffer } from '@wrote/read'

async read(
  path: string,
): string

Read the file as a string.

/* yarn example/ */
import read from '@wrote/read'

(async () => {
  const res = await read('example/data.txt')
  console.log(res)
})()
Hello World

async readBuffer(
  path: string,
): Buffer

Read the file as a Buffer.

/* yarn example/ */
import { readBuffer } from '@wrote/read'

(async () => {
  const res = await readBuffer('example/data.txt')
  console.log(res)
})()
<Buffer 48 65 6c 6c 6f 20 57 6f 72 6c 64>

Copyright

Art Deco © Art Deco for Wrote 2019 Wrote Tech Nation Visa Tech Nation Visa Sucks

Current Tags

  • 1.0.4                                ...           latest (2 years ago)

5 Versions

  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 10
This Month 17
Last Day 0
Last Week 5
Last Month 51
Dependencies (1)
Dev Dependencies (6)

Copyright 2014 - 2016 © taobao.org |