Update preserves to 0.0.9

This commit is contained in:
Tony Garnock-Jones 2019-06-07 13:30:00 +01:00
parent c410692272
commit 5ecadc8acb
7 changed files with 10 additions and 10 deletions

View File

@ -23,6 +23,6 @@
"dependencies": {
"debug": "^4.1.1",
"immutable": "^3.8.2",
"preserves": "0.0.8"
"preserves": "0.0.9"
}
}

View File

@ -80,7 +80,7 @@ spawn named 'driver/avahi-publish' {
on retracted S.Stream(stderr, S.Readable()) topFacet.stop();
on message S.Stream(stderr, S.Line($line)) {
line = line.toString('utf-8');
line = line.fromUtf8();
if (line.startsWith('Established')) {
this.established = true;
} else if (line.startsWith('Disconnected')) {
@ -136,7 +136,7 @@ spawn named 'driver/avahi-browse' {
//
// However, it's still useful to have, so we do our best!
//
const pieces = line.toString('utf-8').split(/;/);
const pieces = line.fromUtf8().split(/;/);
if (pieces[0] === '=') {
// A resolved address record, which has TXT data.
const normalFields = pieces.slice(0, 9);

View File

@ -45,10 +45,10 @@ spawn named 'chatclient' {
assert S.Stream(id, S.BackPressure(stdout));
on message S.Stream(stdin, S.Line($line)) {
send S.Stream(id, S.Push(line.toString('utf-8') + '\n', false));
send S.Stream(id, S.Push(line.fromUtf8() + '\n', false));
}
on message S.Stream(id, S.Line($line)) {
send S.Stream(stdout, S.Push(line.toString('utf-8') + '\n', false));
send S.Stream(stdout, S.Push(line.fromUtf8() + '\n', false));
}
}
}

View File

@ -32,7 +32,7 @@ spawn named 'chatserver' {
on asserted Present($who) send S.Stream(id, S.Push(`${who} arrived.\n`, false));
on retracted Present($who) send S.Stream(id, S.Push(`${who} departed.\n`, false));
on message S.Stream(id, S.Line($line)) send Speak(me, line);
on message S.Stream(id, S.Line($line)) send Speak(me, line.fromUtf8());
on message Speak($who, $what) send S.Stream(id, S.Push(`${who}: ${what}\n`, false));
}
}

View File

@ -41,7 +41,7 @@ spawn named 'chatclient-via-nc' {
react {
on message S.Stream(stdin, S.Line($line)) {
console.log('INPUT:', line);
send S.Stream(i, S.Push(line.toString('utf-8') + '\n', false));
send S.Stream(i, S.Push(line.fromUtf8() + '\n', false));
}
on message S.Stream(stdin, S.End()) {
console.log('INPUT EOF');
@ -49,7 +49,7 @@ spawn named 'chatclient-via-nc' {
}
on message S.Stream(o, S.Line($line)) {
send S.Stream(stdout, S.Push(line.toString('utf-8') + '\n', false));
send S.Stream(stdout, S.Push(line.fromUtf8() + '\n', false));
}
}
}

View File

@ -142,7 +142,7 @@ spawn named 'socks-server' {
case 3: // domain name
readChunk(1, (octetCount) => {
readChunk(octetCount.get(0), (domainNameBytes) => {
const domainName = domainNameBytes.toString('utf-8');
const domainName = domainNameBytes.fromUtf8();
readPort(domainName, k);
});
});

View File

@ -76,7 +76,7 @@ function _collectSource(streamId, cb) {
const chunks = [];
on message S.Stream(streamId, S.Data($chunk)) chunks.push(chunk);
on asserted S.Stream(streamId, S.End()) {
const source = Bytes.concat(chunks).toString();
const source = Bytes.concat(chunks).fromUtf8();
cb(source);
}
}