Header Image. Don't worry, it's not relevant to the content.

How to get the system's EOL character with Deno

Deno's standard library is full of helpful functions for building complex web and server-side apps. However, If you're looking for a predefined function to return the system's end-of-line (EOL) in Deno's standard library, you'll be disappointed. Luckily, it's possible write your own in a pretty small function.

import { EOL } from "https://deno.land/std/fs/eol.ts";

function osEOL(): string {
  return (Deno.build.os == "windows") ? EOL.CRLF : EOL.LF;
}

If you're looking to reliably import this function into your project, you can with: import {osEOL} from "https://crux.land/6R2PS7"