DrSchool Learn coding, fast.
EN AR BN CS DE EL Search

File Read — Example 125

Quick explanation + ready code for: File Read.

F# File Read Back to examples
Back to language
Syntax: File Read in F#. ID: #125

Code

// Node.js example
import fs from "fs";
const txt = fs.readFileSync("README.md","utf8");
console.log(txt.slice(0,120));

Notes

You can copy this snippet and adapt it. For advanced, add real-world inputs, edge cases, and tests.