Compare commits

..

No commits in common. "51eabd809d72b747de9af7e53f640885208a83dd" and "47a0fed27eb3444486290f8914dc00a90cf0e068" have entirely different histories.

3 changed files with 7 additions and 9 deletions

6
dist/index.js vendored
View File

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

View File

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

View File

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