forked from kkevsekk1/kkevsekk1.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
aiselp
committed
May 27, 2023
1 parent
568c463
commit 7e00e26
Showing
7 changed files
with
91 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Buffer | ||
v6.4.0新增 | ||
> 稳定性: 稳定 | ||
node中Buffer的实现,使用文档见node文档,下方是autox中特有的内容 | ||
这个模块全局可用,因此不必 | ||
```js | ||
const Buffer = require("buffer").Buffer; | ||
``` | ||
## Buffer.prototype.getBytes() | ||
返回buffer内部ArrayBuffer所对应的java字节数组 | ||
```js | ||
let buf = Buffer.alloc(10) | ||
let buf2 = Buffer.from(buf.buffer,0,5) | ||
buf[0] = 40; | ||
buf2[2] = 7; | ||
log(buf.getBytes() === buf2.getBytes())//true | ||
``` | ||
## Buffer.fromBytes(byteArr) | ||
* byteArr {\<byte\>[]} java字节数组 | ||
|
||
从字节数组创建一个buffer,其内容是原数据的拷贝。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# event-stream | ||
v6.4.0新增 | ||
> 稳定性: 稳定 | ||
来自npm模块event-stream,如需使用,请用 | ||
```js | ||
const es = require('event-stream') | ||
``` | ||
该模块用于便捷的创建流 | ||
```js | ||
es.readable(function (count, callback) { | ||
if(streamHasEnded) | ||
return this.emit('end') | ||
|
||
//... | ||
|
||
this.emit('data', data) //use this way to emit multiple chunks per call. | ||
|
||
callback() // you MUST always call the callback eventually. | ||
// the function will not be called again until you do this. | ||
}) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# events | ||
v6.4.0新增 | ||
> 稳定性: 稳定 | ||
node中events的实现,如需使用,请用 | ||
```js | ||
const events = require('events') | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# stream | ||
v6.4.0新增 | ||
> 稳定性: 稳定 | ||
注意: <font color="#ef5952">这个模块是异步的,使用此模块请勿阻塞线程</font> | ||
该模块不会自动加载,如需使用,请用 | ||
``` | ||
const stream = require('stream'); | ||
``` | ||
使用方法参考node文档中stream,下方是一些autox中特有的内容 | ||
## stream.fromInputStream(inputStream[,options]) | ||
* inputStream {InputStream} java输入流 | ||
* options {object} 选项,详细见node文档 | ||
|
||
将java流转为Readable可读流,为提高处理速度,默认的缓冲区大小被设为64kb,io操作由内部io线程处理 | ||
## stream.fromOutputStream(outputStream[,options]) | ||
* outputStream {OutputStream} java输出流 | ||
* options {object} 选项,详细见node文档 | ||
|
||
将java流转为Writable可写流,为提高处理速度,默认的缓冲区大小被设为64kb,io操作由内部io线程处理 | ||
## stream.createFileReadStream(path[,bufferSize]) | ||
* path {String} 文件路径 | ||
* bufferSize {Number} 缓冲区大小,默认256k | ||
|
||
从文件创建一个可读流 | ||
## stream.createFileWriteStream(path[,bufferSize]) | ||
* path {String} 文件路径 | ||
* bufferSize {Number} 缓冲区大小,默认256k | ||
|
||
从文件创建一个可写流 |