Skip to content

Commit

Permalink
fetch: use EOL of os-module (#2915)
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak authored Mar 3, 2024
1 parent 2316bae commit c04802b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/web/fetch/file.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
'use strict'

const { EOL } = require('node:os')
const { Blob, File: NativeFile } = require('node:buffer')
const { types } = require('node:util')
const { kState } = require('./symbols')
const { isBlobLike } = require('./util')
const { webidl } = require('./webidl')
const { parseMIMEType, serializeAMimeType } = require('./data-url')
const { kEnumerableProperty } = require('../../core/util')

const encoder = new TextEncoder()

class File extends Blob {
Expand Down Expand Up @@ -307,17 +309,14 @@ function processBlobParts (parts, options) {
*/
function convertLineEndingsNative (s) {
// 1. Let native line ending be be the code point U+000A LF.
let nativeLineEnding = '\n'

// 2. If the underlying platform’s conventions are to
// represent newlines as a carriage return and line feed
// sequence, set native line ending to the code point
// U+000D CR followed by the code point U+000A LF.
if (process.platform === 'win32') {
nativeLineEnding = '\r\n'
}
// NOTE: We are using the native line ending for the current
// platform, provided by node's os module.

return s.replace(/\r?\n/g, nativeLineEnding)
return s.replace(/\r?\n/g, EOL)
}

// If this function is moved to ./util.js, some tools (such as
Expand Down

0 comments on commit c04802b

Please sign in to comment.