If you're OK in having a node-esm executable, please consider this solution.
#!/usr/bin/env sh
# the /usr/local/bin/node-esm executable
input_file=$1
shift
exec node --input-type=module - $@ <$input_file| #!/bin/bash | |
| set -eo pipefail | |
| # Script to build a statically linked version of opus-tools | |
| # | |
| # Release tarballs: | |
| # http://downloads.xiph.org/releases/opus/ | |
| # http://downloads.xiph.org/releases/ogg/ | |
| # http://downloads.xiph.org/releases/flac/ | |
| # |
If you're OK in having a node-esm executable, please consider this solution.
#!/usr/bin/env sh
# the /usr/local/bin/node-esm executable
input_file=$1
shift
exec node --input-type=module - $@ <$input_fileSee also:
| Service | Type | Storage | Limitations |
|---|---|---|---|
| Amazon DynamoDB | 25 GB | ||
| Amazon RDS | |||
| Azure SQL Database | MS SQL Server | ||
| 👉 Clever Cloud | PostgreSQL, MySQL, MongoDB, Redis | 256 MB (PostgreSQL) | Max 5 connections (PostgreSQL) |
You take a stream/buffer of binary data. The start of your data is a "Page", which has a header followed by data.
You need to read the following data from the header (see https://xiph.org/ogg/doc/framing.html for more detail)
capture_pattern - bytes 0 to 3, must read OggSstream_structure_version - byte 4, must be 0header_type_flag - byte 5, a bitflag that tells you metadata about the page (is it a new packet? is a packet continued here? is it the first/last page of the stream?)absolute granule position - bytes 6 to 13, not needed unless you want seekingstream serial number - bytes 14 to 17, a serial number given to each stream contained in the Ogg file. This is important for playing Ogg files that contain other streams, such as video or cover art. You need to identify and only bother parsing the Opus stream.| /* ##### float32encoding.js ##### | |
| MIT License | |
| - Forked 'toFloat' from https://gist.github.com/laerciobernardo/498f7ba1c269208799498ea8805d8c30 | |
| - Forked 'toHex' from stackoverflow answer https://stackoverflow.com/a/47187116/10522253 | |
| - Modifyed by: Jozo132 (https://github.com/Jozo132) | |
| Permission is hereby granted, free of charge, to any person obtaining | |
| a copy of this software and associated documentation files (the | |
| "Software"), to deal in the Software without restriction, including |
| if ('serviceWorker' in navigator) { | |
| window.addEventListener('load', async function() { | |
| const registration = await navigator.serviceWorker.register('/service-worker.js'); | |
| if (registration.waiting && registration.active) { | |
| // The page has been loaded when there's already a waiting and active SW. | |
| // This would happen if skipWaiting isn't being called, and there are | |
| // still old tabs open. | |
| console.log('Please close all tabs to get updates.'); | |
| } else { | |
| // updatefound is also fired for the very first install. ¯\_(ツ)_/¯ |
| const http2 = require('http2'); | |
| const fs = require('fs'); | |
| const path = require('path'); | |
| const zlib = require('zlib'); | |
| const brotli = require('brotli'); // npm package | |
| const PORT = 3032; | |
| const BROTLI_QUALITY = 11; // slow, but we're caching so who cares | |
| const STATIC_DIRECTORY = path.resolve(__dirname, '../dist/'); | |
| const cache = {}; |
| "use strict"; | |
| import http2 from "http2"; | |
| import SocketProxy from "./SocketProxy"; | |
| const Http2Server = http2.createServer().constructor; | |
| // HTTP2 preface from node-spdy | |
| const PREFACE_BUFFER = Buffer.from("PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"); | |
| const PREFACE_BUFFER_LENGTH = PREFACE_BUFFER.length; |
The EventSource API
The EventSource interface is used to receive server-sent events. It connects to a server over HTTP and receives events in text/event-stream format without closing the connection.
https://developer.mozilla.org/en-US/docs/Web/API/EventSource
Last-Event-ID
Setting an ID lets the browser keep track of the last event fired so that if, the connection to the server is dropped, a special HTTP header (Last-Event-ID) is set with the new request.
export x = 42