Compare commits
2 Commits
47a0fed27e
...
51eabd809d
Author | SHA1 | Date |
---|---|---|
Derrick Hammer | 51eabd809d | |
Derrick Hammer | fbaf4314f3 |
|
@ -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 b4a from "b4a";
|
import { Buffer } from "buffer";
|
||||||
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 b4a.from(arg);
|
return Buffer.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 = b4a.from(data.args[0].buffer);
|
data.args[0].buffer = Buffer.from(data.args[0].buffer);
|
||||||
}
|
}
|
||||||
switch (data.action) {
|
switch (data.action) {
|
||||||
case "encode":
|
case "encode":
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
"@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": {
|
||||||
|
|
|
@ -4,6 +4,7 @@ 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;
|
||||||
|
@ -219,7 +220,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 b4a.from(arg);
|
return Buffer.from(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return arg;
|
return arg;
|
||||||
|
@ -227,7 +228,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 = b4a.from(data.args[0].buffer);
|
data.args[0].buffer = Buffer.from(data.args[0].buffer);
|
||||||
}
|
}
|
||||||
switch (data.action) {
|
switch (data.action) {
|
||||||
case "encode":
|
case "encode":
|
||||||
|
|
Loading…
Reference in New Issue