Set the path to a large file in worker.js
Run: node index.js
Then you can run this bash: while true; do date && curl -m 5 http://localhost:3000/ && echo; sleep 1; done
and open a browser http://127.0.0.1:3000/read
| import * as dotenv from 'dotenv' | |
| dotenv.config() | |
| const baseUrl = process.env.SFMC_BASE_URL as string | |
| const tokenUrl = process.env.SFMC_TOKEN_URL_V2 as string | |
| const clientId = process.env.SFMC_CLIENT_ID as string | |
| const clientSecret = process.env.SFMC_CLIENT_SECRET as string | |
| const credentials = { |
| const promise = new Promise((resolve, reject) => { | |
| console.log(1); | |
| setTimeout(() => { | |
| console.log("timerStart"); | |
| resolve("success"); | |
| console.log("timerEnd"); | |
| }, 0); | |
| console.log(2); | |
| }); |
| // Another way is to use const serializables = Symbol(); | |
| const serializables = new WeakMap<object, string[]>(); | |
| type Context = | |
| | ClassAccessorDecoratorContext | |
| | ClassGetterDecoratorContext | |
| | ClassFieldDecoratorContext | |
| ; | |
| function serialize(_target: any, context: Context): void { |
| /** | |
| NoInfer type | |
| */ | |
| function createStreetLight<C extends string>( | |
| colors: C[], | |
| defaultColor?: NoInfer<C>, | |
| ) { | |
| // ... | |
| } | |
| createStreetLight(["red", "yellow", "green"], "red"); // OK |
| // PCI DSS standard password requirement | |
| fn main() { | |
| let regexp = "/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,20}$/"; | |
| } |
| extern crate libc; | |
| use libc::c_char; | |
| use std::ffi::CString; | |
| use std::ffi::CStr; | |
| #[no_mangle] | |
| #[allow(clippy::not_unsafe_ptr_arg_deref)] | |
| // Concatenates an input string with an existing string literal | |
| pub extern "C" fn hello(input: *const c_char) -> *const c_char { |
| const ffi = require('ffi-napi') | |
| const ref = require('ref-napi') | |
| const StructType = require('ref-struct-napi') | |
| const ArrayType = require('ref-array-napi') | |
| // Initialize the C-like array | |
| const OutputArrayType = ArrayType(ref.types.int64, 2) | |
| // Initialize the C-like data struct | |
| const OutputType = StructType({ |
| [package] | |
| name = "embed" | |
| version = "0.1.0" | |
| authors = ["Yevhen Blotskyi <[email protected]>"] | |
| edition = "2018" | |
| # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
| [dependencies] | |
| libc = "*" |
| [package] | |
| name = "find_exam" | |
| version = "0.1.0" | |
| authors = ["Ewen Blotskyi <[email protected]>"] | |
| edition = "2018" | |
| # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
| [dependencies] | |
| serde = { version = "1.0", features = ["derive"] } |