You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Example:
when running the example app from the get get started tutorial the encoding is not set to 'utf-8' and output ist a buffer and not the text of package.json:
noflo-test % ./node_modules/.bin/noflo-nodejs --graph src/graphs/ShowConents.fbp --batch --debug
Debugger attached.
ShowConents started on Fri May 14 2021 03:07:51 GMT+0200 (Mitteleuropäische Sommerzeit)
DATA -> IN Read() DATA
DATA -> ENCODING Read() DATA
Read() OUT -> IN Display() openBracket package.json
Read() OUT -> IN Display() DATA
<Buffer 7b 0a 20 20 22 6e 61 6d 65 22 3a 20 22 6e 6f 66 6c 6f 2d 74 65 73 74 22 2c 0a 20 20 22 76 65 72 73 69 6f 6e 22 3a 20 22 31 2e 30 2e 30 22 2c 0a 20 20 ... 200 more bytes>
Read() OUT -> IN Display() closeBracket package.json
ShowConents ended on Fri May 14 2021 03:08:41 GMT+0200 (Mitteleuropäische Sommerzeit) (uptime 50.001 seconds)
This is the definition in node_modules/noflo-filesystem/components/ReadFile.js:
This is the implementation node_modules/noflo/lib/InPort.js:
// Assign a delegate for retrieving data should this inPortattachSocket(socket,localId=null){// have a default value.if(this.hasDefault()){socket.setDataDelegate(()=>this.options.default);}socket.on('connect',()=>this.handleSocketEvent('connect',socket,localId));socket.on('begingroup',(group)=>this.handleSocketEvent('begingroup',group,localId));socket.on('data',(data)=>{this.validateData(data);returnthis.handleSocketEvent('data',data,localId);});socket.on('endgroup',(group)=>this.handleSocketEvent('endgroup',group,localId));socket.on('disconnect',()=>this.handleSocketEvent('disconnect',socket,localId));socket.on('ip',(ip)=>this.handleIP(ip,localId));}
I was able to debug the problem - socket.setDataDelegate(() => this.options.default); was called on InPort encoding.
her in node_modules/noflo/lib/InternalSocket.js emits the default data in payload:
node_modules/noflo/lib/InPort.js func handleSocketEvent emits the payload
in node_modules/noflo/lib/BaseNetwork.js func sendDefaults() I found this note which could explain the problem:
// Don't send defaults if more than one socket is present on the port.
// This case should only happen when a subgraph is created as a component
// as its network is instantiated and its inputs are serialized before
// a socket is attached from the "parent" graph.
I was able to get the example working by adding an Input in the graph file:
broken:
# In the graph we first need to define the nodes and the connections between them
Read(filesystem/ReadFile) OUT -> IN Display(core/Output)
# Start off the graph by sending a filename to the file reader
'package.json' -> IN Read
working - only if 'utf-8' -> encoding Read is defined before IN Read
# In the graph we first need to define the nodes and the connections between them
Read(filesystem/ReadFile) OUT -> IN Display(core/Output)
# Start off the graph by sending a filename to the file reader
'utf-8' -> encoding Read
'package.json' -> IN Read
The text was updated successfully, but these errors were encountered:
Example:
when running the example app from the get get started tutorial the encoding is not set to 'utf-8' and output ist a buffer and not the text of package.json:
This is the definition in
node_modules/noflo-filesystem/components/ReadFile.js
:This is the implementation
node_modules/noflo/lib/InPort.js
:I was able to debug the problem -
socket.setDataDelegate(() => this.options.default);
was called on InPortencoding
.her in
node_modules/noflo/lib/InternalSocket.js
emits the default data in payload:node_modules/noflo/lib/InPort.js
funchandleSocketEvent
emits the payloadin
node_modules/noflo/lib/BaseNetwork.js
funcsendDefaults()
I found this note which could explain the problem:I was able to get the example working by adding an Input in the graph file:
broken:
working - only if
'utf-8' -> encoding Read
is defined beforeIN Read
The text was updated successfully, but these errors were encountered: