Compare commits

...

2 Commits

3 changed files with 9 additions and 7 deletions

6
dist/index.js vendored
View File

@ -1,7 +1,7 @@
import { Client, factory } from "@lumeweb/libkernel-universal";
import { MODULE } from "@lumeweb/kernel-swarm-client";
import defer from "p-defer";
import b4a from "b4a";
import { Buffer } from "buffer";
export default class Protomux {
isProtomux = true;
constructor(stream) {
@ -137,13 +137,13 @@ class Message extends Client {
if (data.args) {
data.args = data.args.filter((arg) => {
if (arg instanceof Uint8Array) {
return b4a.from(arg);
return Buffer.from(arg);
}
return arg;
});
}
if (data?.args && data?.args[0]?.buffer instanceof Uint8Array) {
data.args[0].buffer = b4a.from(data.args[0].buffer);
data.args[0].buffer = Buffer.from(data.args[0].buffer);
}
switch (data.action) {
case "encode":

View File

@ -6,6 +6,7 @@
"@lumeweb/kernel-swarm-client": "git+https://git.lumeweb.com/LumeWeb/kernel-swarm-client.git",
"@lumeweb/libkernel-universal": "git+https://git.lumeweb.com/LumeWeb/libkernel-universal.git",
"b4a": "^1.6.3",
"buffer": "^6.0.3",
"p-defer": "^4.0.0"
},
"devDependencies": {

View File

@ -4,6 +4,7 @@ import { MODULE } from "@lumeweb/kernel-swarm-client";
import defer from "p-defer";
import b4a from "b4a";
import { Buffer } from "buffer";
export default class Protomux {
private isProtomux = true;
@ -219,7 +220,7 @@ class Message extends Client {
if (data.args) {
data.args = data.args.filter((arg: any) => {
if (arg instanceof Uint8Array) {
return b4a.from(arg);
return Buffer.from(arg);
}
return arg;
@ -227,7 +228,7 @@ class Message extends Client {
}
if (data?.args && data?.args[0]?.buffer instanceof Uint8Array) {
data.args[0].buffer = b4a.from(data.args[0].buffer);
data.args[0].buffer = Buffer.from(data.args[0].buffer);
}
switch (data.action) {
case "encode":