@wrote/read

1.0.4 • Public • Published

@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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.4
    88
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.4
    88
  • 1.0.3
    1
  • 1.0.2
    32
  • 1.0.1
    0
  • 1.0.0
    1

Package Sidebar

Install

npm i @wrote/read

Weekly Downloads

118

Version

1.0.4

License

MIT

Unpacked Size

8.1 kB

Total Files

10

Last publish

Collaborators

  • zvr