Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Question: Passing buffer as an argument works #208

@nveenjain

Description

@nveenjain

Hey everyone, First of all thanks for this awesome runtime, I've been tinkering with napajs, and got to know that Buffer is not transportable, but when i tried to run following code, it runs as expected, Could you please clarify, why? Is this hack allowed, so we could in theory pass any object and napa would not throw any error?

var napa = require('napajs');
var zone1 = napa.zone.create('zone1', { workers: 4 });
var x = (Buffer.from("napajs is awesome","utf8"));
zone1.execute((x)=>{
    console.log(JSON.stringify(String.fromCharCode.apply(null,new Uint8Array(x.data))));
},[x]);

Also, if I want to implement a Transportable class without using decorators, it isn't working.
I'm implementing using:-

class z extends napa.transport.TransportableObject{
...
};
napa.transport.register(z);

It throws error that Class "z" doesn't implement cid(), did you forget put @cid decorator before class declaration? Please help, Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions