@rmw/fsrv

0.0.12 • Public • Published

@rmw/xxx

安装

yarn add @rmw/xxx

或者

npm install @rmw/xxx

使用

#!/usr/bin/env coffee
import Fsrv from '@rmw/fsrv'
import test from 'tape-catch'
import {FLAG_END} from '@rmw/fsrv/const'

test 'fsrv/fs', (t)=>
  f = Fsrv "/Users/z/rmw-link/fsrv"

  # t.equal "", await fsrv.get("src/index.", 5)
  while 1
    for fp from [
      "src/index.coffee"
      "src/const.mjs"
      "src/console.coffee"
    ]
      offset = 0
      while true
        buf = await f.read(fp, offset)
        if 0 == buf.length
          break

        flag = buf[0]
        buf = buf[1..]

        if FLAG_END&flag
          console.log buf.toString('binary')
          break

        if offset == 0
          size = buf[..5].readUintBE 0,6
          buf = buf[5..]

        offset += buf.length
        console.log buf.toString('binary')
    await new Promise((r) => setTimeout(r, 2000))

  t.end()

关于

本项目隶属于人民网络(rmw.link) 代码计划。

人民网络

Readme

Keywords

none

Package Sidebar

Install

npm i @rmw/fsrv

Weekly Downloads

1

Version

0.0.12

License

MulanPSL-2.0

Unpacked Size

13.3 kB

Total Files

7

Last publish

Collaborators

  • gcxfd