Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

oput

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oput - npm Package Compare versions

Comparing version 1.1.2 to 1.2.0

4

dist/index.d.ts

@@ -18,5 +18,5 @@ declare const U32: unique symbol;

lastReadPromise?: Promise<any>;
pull?: (v: any) => void;
constructor(g?: Generator<NeedTypes, void, number | InputTypes> | undefined);
setG(g: Generator<NeedTypes, void, InputTypes | number>): void;
fillFromReader<T extends InputTypes>(source: ReadableStreamDefaultReader<T>): Promise<void>;
consume(): void;

@@ -30,3 +30,3 @@ demand<T extends NeedTypes>(n: T | void, consume?: boolean): ReturnType<T> | undefined;

flush(): InputTypes | number | undefined;
write(value: InputTypes): void;
write(value: InputTypes): Promise<unknown> | undefined;
writeU32(value: number): void;

@@ -33,0 +33,0 @@ writeU16(value: number): void;

@@ -24,16 +24,2 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

}
fillFromReader(source) {
return __awaiter(this, void 0, void 0, function* () {
const { done, value } = yield source.read();
if (done) {
this.close();
return;
}
else {
this.write(value);
return this.fillFromReader(source);
}
});
}
;
consume() {

@@ -58,2 +44,3 @@ if (this.buffer && this.consumed) {

return this.lastReadPromise = new Promise((resolve, reject) => {
var _a;
this.reject = reject;

@@ -66,3 +53,5 @@ this.resolve = (data) => {

};
this.demand(need, true);
const result = this.demand(need, true);
if (!result)
(_a = this.pull) === null || _a === void 0 ? void 0 : _a.call(this, need); //已饥饿,等待数据
});

@@ -148,2 +137,5 @@ });

this.flush();
//富余,需要等到饥饿
if (!this.resolve)
return new Promise((resolve) => this.pull = resolve);
}

@@ -150,0 +142,0 @@ writeU32(value) {

{
"name": "oput",
"version": "1.1.2",
"version": "1.2.0",
"description": "0 put do",

@@ -5,0 +5,0 @@ "main": "src/index.ts",

@@ -17,2 +17,3 @@ const U32 = Symbol(32);

lastReadPromise?: Promise<any>;
pull?: (v: any) => void;
constructor(public g?: Generator<NeedTypes, void, InputTypes | number>) {

@@ -25,12 +26,2 @@ if (g) this.need = g.next().value;

}
async fillFromReader<T extends InputTypes>(source: ReadableStreamDefaultReader<T>): Promise<void> {
const { done, value } = await source.read();
if (done) {
this.close();
return;
} else {
this.write(value!);
return this.fillFromReader(source);
}
};
consume() {

@@ -60,3 +51,4 @@ if (this.buffer && this.consumed) {

};
this.demand(need, true);
const result = this.demand(need, true);
if (!result) this.pull?.(need);//已饥饿,等待数据
});

@@ -115,3 +107,3 @@ }

}
write(value: InputTypes): void {
write(value: InputTypes) {
if ('buffer' in value) {

@@ -123,2 +115,4 @@ this.malloc(value.byteLength).set(new Uint8Array(value.buffer, value.byteOffset, value.byteLength));

if (this.g || this.resolve) this.flush();
//富余,需要等到饥饿
if (!this.resolve) return new Promise((resolve) => this.pull = resolve)
}

@@ -125,0 +119,0 @@ writeU32(value: number) {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc