aboutsummaryrefslogtreecommitdiff
path: root/tests/unistd/io.js
blob: b129af44922f27751a8552e2fdeccbc4decf77c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(function() {
  var devicePayload = [65, 66, 67, 68];
  FS.createDevice('/', 'device', function() {
    if (devicePayload.length) {
      return devicePayload.shift();
    } else {
      return null;
    }
  }, function(arg) {
    print("TO DEVICE: " + arg);
  });
  FS.createDevice('/', 'broken-device', function() {
    throw new Error('Broken device input.');
  }, function(arg) {
    throw new Error('Broken device output.');
  });
  FS.createDataFile('/', 'file', '1234567890', true, true);
  FS.createFolder('/', 'folder', true, true);
})();