@threadedstack/wmd-web 0.1.50 → 0.1.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/RELEASE.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wmd-web",
3
3
  "version": "0.5.1",
4
- "commit": "ce804752cc91e7b05c63ce39a3bdf9713ccfd6b9",
4
+ "commit": "a476a64cf9fa30a12f104c1264550cb29b413ae8",
5
5
  "previous": null,
6
6
  "decisions": [
7
7
  "D-388",
@@ -180,7 +180,7 @@
180
180
  "package.json": "6de9aa9fabdb395651d39997c17e094f01a574f54a36f0af31bd3ffaae53cda1",
181
181
  "src/base.js": "982f8e46dbb727ec542a494ebdb884ccd19a31ff4e091425b2d1fc01b0d4754a",
182
182
  "src/blob.js": "bb2a2f0d87ce236280a7be2f246c926010dfe07f649c27da5e70d8eb5eaf7061",
183
- "src/boot.js": "c84e0abb6c0f626395d8cc0d4ccbca70f50bccecce267e6e993cceda4ff08892",
183
+ "src/boot.js": "d983b2eb5a4faadd0893ce24d3ba27bd20e2bd02a577dcb6658aebb8c94ee491",
184
184
  "src/build/builder.js": "c7794ec15b183213228776c8f4fb0950dec7e621f948358da7de8f90ef4f70ec",
185
185
  "src/build/context.js": "d38097c61dbdadc4d41290c010425a4422f499aba473fa2b83f2a5c41e543571",
186
186
  "src/build/dockerfile.js": "5957fe3d4ac8ff8b312f980ee04bd1d98ad4373a61f9a33e02f1ff1108b6ea53",
@@ -255,7 +255,7 @@
255
255
  "src/edge/sems.js": "f5bd680e67b7ec3eeb16b2f7ac9207b16491001400b435ff5ee3a34f050d8ceb",
256
256
  "src/edge/service-host.js": "f77664be9e3a0cc1cc9b283c5aeda7d94c7a9d61b8cecda5b90822295d315df6",
257
257
  "src/edge/service-port.js": "6daff74e083d8d6e4d3ce950004bafb8632e78c9fbf626197a2c18453ac96eeb",
258
- "src/edge/setup.js": "a868fb062f7ed18f77a517c1b7c6521231d26c29e8e289f83d38415250cc05cf",
258
+ "src/edge/setup.js": "2ee13fbcb0dfd5978540598fb2e085269bd84021419fa71b0cc0ffb901e4cfec",
259
259
  "src/edge/shim.js": "25efa4dddd3bbdd4a2967d99116e10c011a41aa0a4bdd7ce670fbf6d01735a76",
260
260
  "src/edge/site.js": "ff63be7c751678b773fd03e79e551e6fe6e85caa0444b6413b7bb940b8316979",
261
261
  "src/edge/spawn-guard.js": "666cc6cca0628f3c07093f08da277a1d6291eebb91c19abebf0d422f6197e401",
@@ -286,7 +286,7 @@
286
286
  "src/host/base-io.js": "cdd049875dce9f1417f28b27efa2c6f494cbe2a49851249150d0c1ec871a8b59",
287
287
  "src/host/boot-events.js": "a6567c889fa1e95ad7e917107a2593f03d14cc921827616368b3417de96faad2",
288
288
  "src/host/chan-service-entry.js": "18f602f9ad72323e930157cb0820568f3ef83ce49b9672443791b01551f0ffd3",
289
- "src/host/chan-service.js": "71523df6b371e64fbf9c214e3c50f350b6444ac8f27e19e1230dd96043317504",
289
+ "src/host/chan-service.js": "d61afdcbe1a6929dd93a2f7e842c8b94c8d742db59359004d08ec3997b154288",
290
290
  "src/host/chan-services.js": "e7f52931b6ef76a8b97b793d0a1d86fb35d20dbca3dd333d18cc4ded0806c9f7",
291
291
  "src/host/chan.js": "bb9e76890b0efeee7cfbd8481b9fb4620b3b184459d96d62ff68ddcdc8a46f83",
292
292
  "src/host/ckpt-file.js": "da7938fa640a062e77bdfb59caad5b3b1fcbf6150e3220de3be23f253f4c4497",
@@ -319,7 +319,7 @@
319
319
  "src/host/p9mount.js": "cd27abd769b19ed8b26050ddd8b6d61f81faa5a431924217dd0bf2593258d5b9",
320
320
  "src/host/pinned-fetch.js": "873eb804604c150f6c8e488eb6c49fb8dc7a85108e80bf1a831904b9555726eb",
321
321
  "src/host/ram-mem.js": "bf4036d5d12be1d5d2f5223e526b0b8e225bc702ae7e60a2a59fdfe9fbbb49e3",
322
- "src/host/stdio.js": "43973675578eb1d324c2c6d7078e51a6a1f121190ada5ef14a5551364b8c7f5e",
322
+ "src/host/stdio.js": "07881f378ac805bfd8e385dd51184fe5f16c67667b775fed28551f66b4100e66",
323
323
  "src/host/threads.js": "952381940e7f43114867e9a9714528f2f20c8064b6b0f2018ab075128dc601be",
324
324
  "src/host/wasi.js": "fbafa239b8fb4083f7e8c910b1adab38901e8e7cffd247284a9abb2847eaf4bd",
325
325
  "src/host/wmd-imports.js": "3a00562f7c9c7787ab3841b14dde5d903a78f43ed19c43a2f5e31fd8a14c09d2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threadedstack/wmd-web",
3
- "version": "0.1.50",
3
+ "version": "0.1.52",
4
4
  "license": "MIT",
5
5
  "homepage": "https://github.com/threadedstack/wmd-releases",
6
6
  "repository": {
@@ -9,8 +9,8 @@
9
9
  },
10
10
  "description": "Browser host for wmd's guest vm.wasm (Web Workers + shared memory + WASI preview1)",
11
11
  "wmd": {
12
- "tag": "v0.1.50",
13
- "commit": "ce804752cc91e7b05c63ce39a3bdf9713ccfd6b9",
12
+ "tag": "v0.1.52",
13
+ "commit": "a476a64cf9fa30a12f104c1264550cb29b413ae8",
14
14
  "web": "0.5.1"
15
15
  },
16
16
  "type": "module",
package/src/boot.js CHANGED
@@ -40,7 +40,7 @@ import { bootFileName, cachedFromTiming, createBootEvents, createWorkerList, rea
40
40
  import { createJitStore, readJitStats, tableMinOf } from './host/jit.js'
41
41
  import { createJitCacheHost } from './host/jit-cache.js'
42
42
  import { createPanicScanner, createThrottleMeter, createWatchdog, watchdogDefaultMs } from './host/monitor.js'
43
- import { BOOT_RING, createStdio, stdioReader, stdioText } from './host/stdio.js'
43
+ import { BOOT_RING, MOBILE_RING, createStdio, stdioReader, stdioText } from './host/stdio.js'
44
44
  import {
45
45
  CONSOLE_IN_LIMIT, chanCounters, chanView, consoleInputGate, createChanBlock, markGuestGone, markServiceDead, ringBell, ringRead,
46
46
  } from './host/chan.js'
@@ -348,6 +348,14 @@ export function heapReserveDefault(nav = globalThis.navigator) {
348
348
  return !isMobileWebKit(nav)
349
349
  }
350
350
 
351
+ /**
352
+ * IOS-1: bootWmd's stdout/stderr ring per fd when the caller names none. MOBILE_RING (4 MiB) in mobile WebKit, which
353
+ * counts the rings' whole SharedArrayBuffer as the tab's memory at once (D-516); BOOT_RING (32 MiB) elsewhere.
354
+ */
355
+ export function stdioRingDefault(nav = globalThis.navigator) {
356
+ return isMobileWebKit(nav) ? MOBILE_RING : BOOT_RING
357
+ }
358
+
351
359
  /**
352
360
  * W34: the bytes of live JIT modules a WebKit page can hold, so that the machine's memory at its
353
361
  * maximum + the page's own files + the engine's copies of the modules stay under 5.5 GiB (2.5 GiB
@@ -838,7 +846,7 @@ export function diskArgs(args, disk) {
838
846
  * (host/jit-cache.js). Needs sharing. Counters in timings.jit (cacheHits, cacheMisses,
839
847
  * translated, ...) and timings.jitCache; the index is put before vm.exited resolves (up to 10 s).
840
848
  * @param {number} [o.stdioRingBytes] stdout/stderr ring per fd (power of two; default
841
- * BOOT_RING, 32 MiB). If the page falls a whole ring behind, the skipped bytes are
849
+ * stdioRingDefault(): BOOT_RING, 32 MiB; MOBILE_RING, 4 MiB, in mobile WebKit). If the page falls a whole ring behind, the skipped bytes are
842
850
  * replaced in the delivered text by a "[wmd-web: N bytes of stdout were dropped]" line.
843
851
  * @param {number} [o.watchdogMs] end the boot (code -2) when the guest writes nothing and
844
852
  * spawns no thread for this long after it starts. 0 = off.
@@ -1393,7 +1401,7 @@ async function bootMachine(o) {
1393
1401
  // Firefox past its per-process wasm code limit), or that starts after the log reused the bytes of early
1394
1402
  // Modules, compiles its copy from bytes the hub keeps (W31b), so every browser reclaims. o.jitReclaim overrides.
1395
1403
  const jitStore = o.jit === false ? null : restoreIn?.jit ? restoreStore(restoreIn.jit, { reclaim: o.jitReclaim ?? true }) : createJitStore({ reclaim: o.jitReclaim ?? true })
1396
- const stdio = createStdio(o.stdioRingBytes ?? BOOT_RING)
1404
+ const stdio = createStdio(o.stdioRingBytes ?? stdioRingDefault())
1397
1405
  let memTook = absMs() - tMem // the memory, the control block, the JIT store and the stdio rings (the channel block is added below)
1398
1406
  const out = stdioReader(stdio)
1399
1407
  const outText = stdioText(out)
@@ -1434,6 +1442,7 @@ async function bootMachine(o) {
1434
1442
  let netWorker = null
1435
1443
  let goWorker = null // X6 (default off): the Wasm twin of the guest's Go compiler
1436
1444
  let goCspOff = null // takes the document's policy-violation listener of the live twin Worker off again
1445
+ let goPending = null // IOS-1: the twin's end of its channel, held until the channel service asks for the Worker (gowasm-need: the image has a Go tool)
1437
1446
  let netStats = null
1438
1447
  let netMember = null // W56: this guest on an in-page switch (switch.js attach())
1439
1448
  const netWaiters = new Map()
@@ -1542,10 +1551,25 @@ async function bootMachine(o) {
1542
1551
  }
1543
1552
  else if (m.t === 'gowasm') ev({ t: 'gowasm', ...m.rec })
1544
1553
  else if (m.t === 'gowasm-event') ev({ t: m.ev.t, ...m.ev }) // X6: the twin is off for this machine (why)
1554
+ else if (m.t === 'gowasm-need') {
1555
+ // IOS-1: the image has a Go tool the twin stands for: its Worker starts now (it used to start at boot for every image, and fetched and compiled the
1556
+ // Go compiler's module at once, memory a phone does not have for an image that never compiles Go)
1557
+ const p = goPending
1558
+ goPending = null
1559
+ if (p && !goWorker) {
1560
+ try {
1561
+ spawnGoTwin(p)
1562
+ } catch (err) {
1563
+ chanSvc?.postMessage({ t: 'gowasm-died', why: `the twin Worker could not start: ${(err && err.message) || err}` })
1564
+ }
1565
+ }
1566
+ }
1545
1567
  else if (m.t === 'gowasm-stop') {
1546
1568
  goWorker?.terminate()
1547
1569
  goWorker = null
1548
1570
  goCspOff?.()
1571
+ goPending?.close() // IOS-1: an image with no Go tool: the twin's Worker was never started
1572
+ goPending = null
1549
1573
  }
1550
1574
  else if (m.t === 'gowasm-restart') {
1551
1575
  // the twin was in the middle of a compile that was cancelled: a Worker cannot be stopped inside one, so it ends and a new one starts
@@ -1618,8 +1642,9 @@ async function bootMachine(o) {
1618
1642
  netWorker.postMessage({ t: 'init', port: mc.port2, relay, instance: netInstance, names: [...netNames], switchPort: netMember?.port, config, maxConns: netSvc.maxConns }, transfer)
1619
1643
  }
1620
1644
  const goSvc = chanSvcs.find(s => s.gowasm)
1621
- const spawnGoTwin = () => {
1622
- const mc = new MessageChannel()
1645
+ // IOS-1: `port` is the twin's end of a channel made earlier (the first start, on gowasm-need); a restart makes a new channel and returns its other end
1646
+ const spawnGoTwin = (port = null) => {
1647
+ const mc = port ? { port1: null, port2: port } : new MessageChannel()
1623
1648
  const w = (goWorker = new Worker(new URL('./host/gowasm-worker.js', import.meta.url), { type: 'module', name: 'wmd-gowasm' }))
1624
1649
  w.onerror = err => chanSvc?.postMessage({ t: 'gowasm-died', why: `the twin Worker failed: ${err.message || err}` })
1625
1650
  // fix 10 (F4): a policy violation the document sees is told to the Worker too (the Worker listens for its own); its reason text then says the policy blocked the source
@@ -1645,9 +1670,14 @@ async function bootMachine(o) {
1645
1670
  let gowasmPort = null
1646
1671
  let gowasmWhy = ''
1647
1672
  // part 6: a service whose gowasm field says `off` (a checkpoint taken with the twin, restored in a boot that has the twin off) gets no Worker
1673
+ // IOS-1: the channel is made now and the Worker only when the channel service says the image has a Go tool (gowasm-need); what the service posts to
1674
+ // the twin before that waits in the channel
1648
1675
  if (goSvc && !goSvc.gowasm.off) {
1649
1676
  try {
1650
- gowasmPort = spawnGoTwin()
1677
+ if (typeof Worker !== 'function') throw new Error('this page has no Worker')
1678
+ const mc = new MessageChannel()
1679
+ gowasmPort = mc.port1
1680
+ goPending = mc.port2
1651
1681
  } catch (err) {
1652
1682
  gowasmWhy = `the twin Worker could not start: ${(err && err.message) || err}`
1653
1683
  }
@@ -1890,6 +1920,8 @@ async function bootMachine(o) {
1890
1920
  netWorker?.terminate()
1891
1921
  goWorker?.terminate()
1892
1922
  goCspOff?.()
1923
+ goPending?.close()
1924
+ goPending = null
1893
1925
  netMember?.detach() // W56: its peers' streams to it fail; the name keeps its address
1894
1926
  if (netWorker) timings.net = netStats
1895
1927
  if (chanSab) timings.chan = { ...chanCounters(chanSab), service: chanStats, died: chanDied }
@@ -2,7 +2,7 @@
2
2
  // The files of node in the sandboxed frame: the path under a source (the option edge: { sources } of bootWmd), the role the frame gives the file, its
3
3
  // sha256 and its size. The page accepts a file only when it has exactly this sha256 and size. The notice files travel with the rest.
4
4
  // EDGE_PACKAGE is the package that holds these files, for the {name} {version} {file} of a registry source's url (null: none named).
5
- export const EDGE_PACKAGE = { name: '@threadedstack/wmd-node', version: '0.1.50' }
5
+ export const EDGE_PACKAGE = { name: '@threadedstack/wmd-node', version: '0.1.52' }
6
6
  export const EDGE_PINS = [
7
7
  { path: 'wmd_browser_bg.wasm', role: 'wasm', sha256: '1e3db7f2c5f4be0ee44e5f2c0205cf8ca11f906d9addd5512915fad4821661c2', size: 6334959 },
8
8
  { path: 'wmd_browser.js', role: 'glue', sha256: 'b389b072096881ba39b22cd705d3a230af02acc5409c61fb4f997d1081c4df6f', size: 75647 },
package/src/edge/setup.js CHANGED
@@ -85,12 +85,13 @@ const idleOf = g => (typeof g.requestIdleCallback === 'function' ? f => g.reques
85
85
  * @param {boolean} [o.fscache] false: no start keeps file answers (default on in every browser, src/edge/sbx/cap.js FSCACHE_OFF; a browser that fails the equality proof is off there only)
86
86
  * @param {number} [o.frameCap] the most frames of node this page has alive at once (default by browser, src/edge/sbx/cap.js); a start that needs a new one over it runs in the guest
87
87
  * @param {boolean} [o.prepare] false: no frame is made before the first node command (default true, with keepFrame)
88
+ * @param {boolean} [o.early] false: python's module and the runtime's files are fetched only from prepare() on (default: from the setup on, when python is planned)
88
89
  * @param {function} [o.onLog] (id, record) of each run, and the site's events ({type: 'site', ...})
89
90
  * @param {function} [o.onBridge] (bridge) when a machine's bridge is made
90
91
  * @param {{on: number, off: object}} counts the plan's decisions, counted (src/boot.js edgePlanCounts)
91
92
  */
92
93
  export function edgeSetupIn(o, counts) {
93
- const { origin: siteOrigin, sources, base, pinned = null, fetchFiles: fetchFilesOpt, fetchOpts = {}, filesWaitMs, filesRetryMs, filesProgressMs, frameCap: frameCapOpt, fscache: fscacheOpt, python: pythonAsk, imagePython, pythonMaxMiB, fetchPython: fetchPythonOpt, ramMiB = 0, main = [], memoryMB = 0, swapMB = 0, env = [], user = '', readonlyRoot = false, hasTmpfs = false, p9port = 564, root = 'rootfs', settings = {}, rt = RT_DEFAULT, handIn = null, watch = {}, prepare = true, shareSite = false, edgeWasm = '/wasm/edgejs.wasm', onLog = () => {}, onBridge = () => {}, doc = globalThis.document, win = globalThis } = o
94
+ const { origin: siteOrigin, sources, base, pinned = null, fetchFiles: fetchFilesOpt, fetchOpts = {}, filesWaitMs, filesRetryMs, filesProgressMs, frameCap: frameCapOpt, fscache: fscacheOpt, python: pythonAsk, imagePython, pythonMaxMiB, fetchPython: fetchPythonOpt, ramMiB = 0, main = [], memoryMB = 0, swapMB = 0, env = [], user = '', readonlyRoot = false, hasTmpfs = false, p9port = 564, root = 'rootfs', settings = {}, rt = RT_DEFAULT, handIn = null, watch = {}, prepare = true, early = true, shareSite = false, edgeWasm = '/wasm/edgejs.wasm', onLog = () => {}, onBridge = () => {}, doc = globalThis.document, win = globalThis } = o
94
95
  const sandbox = !siteOrigin
95
96
  const origin = sandbox ? SANDBOX : siteOrigin
96
97
  // X25: python in the frame follows the switch of node (`edge`) and has its own, `python: false`; the page's plan for the image's python is planPython
@@ -179,6 +180,14 @@ export function edgeSetupIn(o, counts) {
179
180
  ...(filesRetryMs !== undefined ? { retryMs: filesRetryMs } : {}),
180
181
  ...(filesProgressMs !== undefined ? { progressMs: filesProgressMs } : {}),
181
182
  })
183
+ // PYFRAME-1: a python start in the frame needs python's module and the runtime's files; the downloads begin now (before the boot, network only: no frame
184
+ // is made and nothing compiled here) instead of when the page is idle after the boot, which a command that comes right after the boot waited for.
185
+ // Only with a frame made ahead (prepare and keepFrame on); `early: false` keeps the old order.
186
+ const earlyPy = !!pyGate && early !== false && prepare && watch.keepFrame !== false
187
+ if (earlyPy) {
188
+ pyGate.begin()
189
+ gate.begin()
190
+ }
182
191
  const site = frameSite({ origin, probe: sandbox ? () => sbx.files().then(r => !r.error) : iframeProbe({ doc, win }), onEvent: e => onLog(0, e) })
183
192
  // what a start waits for: node's files (the gate of item 12); and when the page planned python, python's module too. A start that is python's goes to the guest while
184
193
  // python's module is loading or when its fetch failed; a start of node goes to the guest only while it is loading (a failed fetch leaves python in the guest).
@@ -235,6 +244,8 @@ export function edgeSetupIn(o, counts) {
235
244
  onMessage: (m, machine) => mine.onMessage(m, machine),
236
245
  }
237
246
  }
247
+ let holdSite = null // PYFRAME-1: the setup's own use of the site while its early-prepared frame waits for a machine
248
+ let closed = false
238
249
  const e = {
239
250
  use: true,
240
251
  reason: '',
@@ -260,7 +271,9 @@ export function edgeSetupIn(o, counts) {
260
271
  const go = async () => {
261
272
  if (sandbox) pyGate?.begin() // python's module comes with them
262
273
  if (sandbox) gate.begin() // the files come while the frame is made (a node start finds them in, or waits at most FILES_WAIT_MS)
263
- const { prepareEdge } = await import('./page.js')
274
+ const { prepareEdge, useSite } = await import('./page.js')
275
+ // PYFRAME-1: a frame prepared before the boot is held by the setup until close() (a boot that fails or never comes leaves no frame behind)
276
+ if (earlyPy && !holdSite && !closed) holdSite = useSite(owner, origin)
264
277
  if (sandbox) await sbx.loadCode()
265
278
  const cfg = { rt, ...runtimeConfig(rt, sandbox ? { ...handIn, sbx: true, ...fscHand } : handIn), edgeWasm: prepWasm, ...(sandbox ? { linuxSrc: 'sbx:linux.cjs' } : {}), linux: {}, ...(pyPlan.use && prepWasm !== nodeWasm ? { memoryMaxMiB: capMiB } : {}) }
266
279
  p.started = Math.round(performance.now())
@@ -273,9 +286,15 @@ export function edgeSetupIn(o, counts) {
273
286
  return p
274
287
  },
275
288
  close() {
289
+ closed = true
290
+ holdSite?.()
291
+ holdSite = null
276
292
  pers.forEach(per => per.close())
277
293
  if (!sandbox) releaseSite(doc, origin, owner)
278
294
  },
279
295
  }
296
+ // PYFRAME-1: with python planned the frame is made and python's module compiled while the machine boots (the page's idle time during the boot), not after
297
+ // it: the first python start then finds the module compiled. A boot's own prepare() call takes this one.
298
+ if (earlyPy) e.prepare()
280
299
  return e
281
300
  }
@@ -341,9 +341,11 @@ async function init(m) {
341
341
  lateFallbackAt: goSvc.gowasm.lateFallbackAt | 0, // test hook, default 0 (off)
342
342
  mounts: goSvc.gowasm.mounts || null,
343
343
  })
344
- goEdge.pruneBundle() // an image with no Go compile: its stub mounts go out of the bundle before the guest starts the container
345
- await goEdge.pruneUnpinned() // a Go release the pins do not name: its stubs go out too (the guest runs it alone), one calm event
344
+ const pb = goEdge.pruneBundle() // an image with no Go compile: its stub mounts go out of the bundle before the guest starts the container
345
+ const pu = await goEdge.pruneUnpinned() // a Go release the pins do not name: its stubs go out too (the guest runs it alone), one calm event
346
346
  bindGoPort(m.gowasmPort)
347
+ // IOS-1: the page starts the twin's Worker only for an image that kept a tool the twin stands for; with none it never starts (no Worker, nothing fetched)
348
+ self.postMessage({ t: pb.kept && pu.kept ? 'gowasm-need' : 'gowasm-stop' })
347
349
  }
348
350
  if (offSvc) {
349
351
  twinOffWhy = offSvc.gowasm.off // the stats carry it as gowasmOff, as for noTwin
package/src/host/stdio.js CHANGED
@@ -17,6 +17,10 @@ export const RING = 1 << 22 // default bytes per fd for createStdio()
17
17
  // minutes hidden). It costs 64 MiB of SharedArrayBuffer (pages are touched only as
18
18
  // the ring fills), against the guest's 640 MiB shared memory.
19
19
  export const BOOT_RING = 1 << 25
20
+ // IOS-1: bootWmd's default in mobile WebKit, which counts every byte of a SharedArrayBuffer the moment it is made
21
+ // (D-516): 2 x 4 MiB instead of 2 x 32 MiB, 56 MiB less on a phone. 4 MiB is about 12 s of console with no page
22
+ // event served; iOS suspends a hidden tab's Workers with the page, so the long hidden-tab gap does not arise there.
23
+ export const MOBILE_RING = RING
20
24
  const H_LOCK = 0
21
25
  const H_W1 = 1 // bytes ever written to fd 1, mod 2^32
22
26
  const H_W2 = 2 // ... fd 2
package/wmdpack.wasm CHANGED
Binary file