profile
viewpoint
Marcos Casagrande marcosc90 Madrid, Spain https://markbighouse.io/ @denoland & @nodejs contributor

marcosc90/node-jsdifflib 2

A javascript library for diffing text and generating corresponding HTML views

marcosc90/base64-stream 1

Base64 stream decoder/encoder for Deno

marcosc90/downldr 1

A simple downloader that prevents writing invalid files

marcosc90/express-superstruct 1

Express validator middleware using Superstruct

marcosc90/deno 0

A secure JavaScript and TypeScript runtime

marcosc90/deno_website2 0

deno.land website

marcosc90/encoding-wasm 0

WASM Base64 encoder/decoder

marcosc90/express-busboy 0

A simple body-parser like module for express that uses connect-busboy under the hood.

Pull request review commentdenoland/deno

Add node/string_decoder and some more

+import { assertEquals } from "../testing/asserts.ts";+import Buffer from "./buffer.ts";+import { StringDecoder } from "./string_decoder.ts";+

Could you please bring in these tests too:

https://github.com/nodejs/node/blob/master/test/parallel/test-string-decoder-end.js https://github.com/nodejs/node/blob/master/test/parallel/test-string-decoder-fuzz.js

As well as https://github.com/nodejs/node/blob/f902170af6e19ab0f2d5cefdf7111580238cbeb7/test/parallel/test-string-decoder.js#L28-L35

Soremwar

comment created time in 22 days

pull request commentdenoland/deno

Add node/string_decoder and some more

@marcosc90 could you review this PR?

Yes, I'll review it properly over the weekend @Soremwar

Soremwar

comment created time in 22 days

delete branch marcosc90/deno

delete branch : disable-max-buffer-tests

delete time in 22 days

pull request commentdenoland/deno

test: ignore max buffer tests

cc/ @bartlomieju

marcosc90

comment created time in 22 days

push eventmarcosc90/deno

Marcos Casagrande

commit sha 7bf82c63c3fd8ccda146a60c33518f8ecb49946f

test: ignore max buffer tests

view details

push time in 22 days

PR opened denoland/deno

test: ignore max buffer tests

Fixes #6731

Disable MAX_SIZE buffer tests until we come up with a better solution.

+1 -6

0 comment

1 changed file

pr created time in 22 days

create barnchmarcosc90/deno

branch : disable-max-buffer-tests

created branch time in 22 days

issue commentdenoland/deno

Flaky tests for Buffer max size

Weird that MAX_SIZE allocation isn't failing once the test starts, and fails later.

We can ignore those tests. Unfortunately, the only way to test MAX_SIZE logic is reading MAX_SIZE bytes, and if the environment doesn't have enough memory it will fail.

As an alternative, we can add a maxSize argument to Buffer.

Thoughts?

bartlomieju

comment created time in 22 days

delete branch marcosc90/deno

delete branch : buffer-bytes-arg

delete time in 23 days

delete branch marcosc90/deno

delete branch : fix-6708-fetch-redirect

delete time in 23 days

push eventmarcosc90/deno

Marcos Casagrande

commit sha 4fcd9813915e66fc6b00002f0f76d1cab1d7622f

CI - flaky test

view details

push time in 23 days

push eventmarcosc90/deno

Marcos Casagrande

commit sha 4bb39c481016cb76a7b7f191fce7d4140db0bc7f

reuse redirect server

view details

push time in 23 days

Pull request review commentdenoland/deno

fix(cli/fetch): fix relative redirect

 pub async fn run_all_servers() {   let absolute_redirect_server_fut =     warp::serve(routes).bind(([127, 0, 0, 1], REDIRECT_ABSOLUTE_PORT)); +  let routes = warp::path!("a" / "b" / "c")

@ry added the route to one of the other servers.

marcosc90

comment created time in 23 days

push eventmarcosc90/deno

Marcos Casagrande

commit sha d5fdc580f6cf4e3e6044cc33cc6a7454f403eab3

reuse redirect server

view details

push time in 23 days

Pull request review commentdenoland/deno

fix(cli/fetch): fix relative redirect

 pub async fn run_all_servers() {   let absolute_redirect_server_fut =     warp::serve(routes).bind(([127, 0, 0, 1], REDIRECT_ABSOLUTE_PORT)); +  let routes = warp::path!("a" / "b" / "c")

I wanted to, but with my limited rust knowledge was the best I could do. Probably can be added very easily to one of the other servers.

Need the request to redirect to the same server either with: some-path or /some-path, without causing a redirect loop.

marcosc90

comment created time in 23 days

push eventmarcosc90/deno

Marcos Casagrande

commit sha 96440ec333e39e18a783f52e077a833b8f7a8bf6

CI

view details

push time in 23 days

push eventmarcosc90/deno

Marcos Casagrande

commit sha df229c37e205854a1e02312fa1fed8ddac1ddc6c

Format rust code

view details

push time in 23 days

Pull request review commentdenoland/deno

fix(cli/fetch): fix relative redirect

 pub async fn run_all_servers() {   let absolute_redirect_server_fut =     warp::serve(routes).bind(([127, 0, 0, 1], REDIRECT_ABSOLUTE_PORT)); +  let routes = warp::path!("a" / "b" / "c")

This is working fine, but I have less than 2 hours of rust coding in my life :stuck_out_tongue: , so feel free to improve it.

marcosc90

comment created time in 23 days

push eventmarcosc90/deno

Marcos Casagrande

commit sha dc910f1e6a21d7ef45de3f3080807a2b12cdf8e5

relative redirect server & fetch test

view details

push time in 23 days

push eventmarcosc90/deno

Marcos Casagrande

commit sha fd16577a1cce31977f0d53953f88e8ea4bd86923

fix(cli/fetch): fix relative redirect Fixes #6708

view details

push time in 23 days

PR opened denoland/deno

fix(cli/fetch): fix relative redirect

Fixes #6708

<!-- Before submitting a PR, please read https://github.com/denoland/deno/blob/master/docs/contributing.md -->

Working on adding tests for fetch_test.ts

+14 -5

0 comment

2 changed files

pr created time in 23 days

create barnchmarcosc90/deno

branch : fix-6708-fetch-redirect

created branch time in 23 days

issue commentdenoland/deno

Fetch seems to be fetching wrongly formatted URL when it involves redirect

Found the issue, working on a fix right now.

just-small-potato

comment created time in 23 days

push eventmarcosc90/deno

Marcos Casagrande

commit sha 2d06770d3b75409e235d1bf7429a9bbb1eea7e66

remove interface

view details

push time in 24 days

Pull request review commentdenoland/deno

feat(cli): add copy argument to Buffer.bytes

 export class Buffer implements Reader, ReaderSync, Writer, WriterSync {     this.#buf = new Uint8Array(ab);   } -  bytes(): Uint8Array {+  bytes(options: BytesOptions = { copy: true }): Uint8Array {

I had it that way initially, then I added the interface, I'll change it back.

marcosc90

comment created time in 24 days

pull request commentdenoland/deno

feat(cli): add copy argument to Buffer.bytes

You're right, added an options argument so it'll be easier to extend without breaking changes.

marcosc90

comment created time in 24 days

push eventmarcosc90/deno

Marcos Casagrande

commit sha 1a5431eaa3b4c65d6b770811da1486465088dddf

Add options arguments

view details

push time in 24 days

push eventmarcosc90/deno

Marcos Casagrande

commit sha 25687f2c8e4370ec99d524feec8a09f044c644ed

use strict comparison

view details

push time in 25 days

push eventmarcosc90/deno

Marcos Casagrande

commit sha 97a2d54aeed5905ee2d3956d257098a7f8ba7998

Update jsdoc

view details

push time in 25 days

push eventmarcosc90/deno

Marcos Casagrande

commit sha 2494cfba7c5b5c19836a5877142d706d0b2b721a

CI

view details

push time in 25 days

push eventmarcosc90/deno

Marcos Casagrande

commit sha 9558af0df63a1ed09fdddb09a2b748ee8475e371

CI

view details

push time in 25 days

push eventmarcosc90/deno

Marcos Casagrande

commit sha 5c60468c43e1ff33bbfae080a81d86f4fa9db40e

Update jsdoc

view details

push time in 25 days

push eventmarcosc90/deno

Marcos Casagrande

commit sha 9a8cb3a495911f70cd18a96dad299c1a07a5c96f

feat(cli): add copy argument to Buffer.bytes

view details

push time in 25 days

PR opened denoland/deno

feat(cli): add copy argument to Buffer.bytes

Added copy = true argument to Buffer.bytes method.

In most cases the underlying ArrayBuffer size is greater than buf.length, reason why .slice (#6511) it's used to create a copy where ArrayBuffer.byteLength === Uint8Array.byteLength, but sometimes you don't need a copy and prefer the speed of .subarray

+37 -6

0 comment

3 changed files

pr created time in 25 days

create barnchmarcosc90/deno

branch : buffer-bytes-arg

created branch time in 25 days

delete branch marcosc90/deno

delete branch : fix-buffer-grow

delete time in 25 days

push eventmarcosc90/deno

Marcos Casagrande

commit sha 2da084058397efd6f517ba98c9882760ec0a7bd6

fix(std/io): export streams.ts & added docs (#6535)

view details

Marcos Casagrande

commit sha d779053dc6ea6aafef06f8a5e7f28cbbc8166864

feat(std/node): Add Buffer.allocUnsafe (#6533)

view details

Haoran Liu

commit sha 1c12098e4a4fbbf981574fafe5ac5a97294c17a0

docs: update macOS dependencies of building V8 from source (#6538)

view details

Marcos Casagrande

commit sha 89ebe2079bf51ec55c89c093ab16c3179ccd43fe

fix(cli/body): Maximum call stack size exceeded error (#6537)

view details

Valentin Anger

commit sha 660f86f1a21298f7795760a24b91b7bd8788afc3

fix(cli/doc): doc printer missing [] around tuple type (#6523)

view details

Casper Beyer

commit sha 96b4a5f837fe984a91c03babc398fb55a6210610

docs(std): update paragraph about the tagging process (#6519)

view details

Marcos Casagrande

commit sha 0374eadcf7ecb054dae1b1587843a2006fdf4c2d

feat(std/node): Add Buffer.isEncoding (#6521)

view details

Valentin Anger

commit sha db36857288609858ada259444509a31637980ce3

refactor: util functions take slices instead of heap values (#6547)

view details

Andrey Filatkin

commit sha a690a206790778cf63df876fdeefebc17607e5c8

fix(cli/upgrade): upgrade fails on Windows with space in temp path (#6522)

view details

Casper Beyer

commit sha 06f34a1aed2541866f32438d7bbc75e35c1d5dc3

feat(std/wasi) implement fd_filestat_get (#6555)

view details

Oron Sharabi

commit sha 53f8d96a1faf3b0f97e793b2e4ea86c64c12cbfa

fix(std/http): Support ipv6 parsing (#5263)

view details

Casper Beyer

commit sha 4cde7fdc9a52088f8dfe3e23569d6be2faa80d0f

feat(std/wasi): implement fd_datasync (#6556)

view details

Casper Beyer

commit sha 3c5459d849502963ee44efc7c3137db6e9fc63b2

feat(std/wasi) implement fd_filestat_set_size (#6558)

view details

Ryan Dahl

commit sha f5242f333ec8ba3c1f4bea88a5b4c55bb14dbfb7

fix(std/node): do not use absolute urls (#6562)

view details

Ryan Dahl

commit sha a19d6a2613b65771748cee97c620c04a62e8a6e4

ignore PoisonError in test_server (#6567)

view details

Casper Beyer

commit sha cb16439e85ed4f5de7b7017e1a994780ff670e37

feat(std/wasi): implement fd_sync (#6560)

view details

Casper Beyer

commit sha 9b749945bbb8c86ef1fcad9603bd7a84f27bdd8f

test(std/wasi): add hard-link test (#6571)

view details

Casper Beyer

commit sha 971dfcf9bbf469b4d21f4a614d3f825528d748f5

test(std/wasi): add rename test (#6573)

view details

Water Zheng

commit sha 6844c3ac0ea4afcb799bba4945b400a011eb5d84

fix(std/log): print "{msg}" when log an empty line (#6381)

view details

Kitson Kelly

commit sha 062d1a41ea6ab22bab36e54d1f1222fc09351bf3

refactor: Improvements to TsCompiler and its tests (#6576)

view details

push time in 25 days

delete branch marcosc90/deno

delete branch : fix-buffer-grow-alt

delete time in 25 days

pull request commentdenoland/deno

fix(cli/buffer): allow Buffer to store MAX_SIZE bytes (ALT)

@ry This is ready for review.

marcosc90

comment created time in a month

PR closed denoland/deno

fix(cli/buffer): allow Buffer to store MAX_SIZE bytes

fixes #6543

+111 -18

3 comments

2 changed files

marcosc90

pr closed time in a month

pull request commentdenoland/deno

fix(cli/buffer): allow Buffer to store MAX_SIZE bytes

Closing in favor of #6570

marcosc90

comment created time in a month

push eventmarcosc90/deno

Marcos Casagrande

commit sha d5ae08e6fcc0715e148775905fbc418f4ba5b7ac

read directly to internal buffer when possible

view details

push time in a month

push eventmarcosc90/deno

Marcos Casagrande

commit sha 50d5612df28edcd907051bd843184730913a6bf3

read directly to internal buffer when possible

view details

push time in a month

pull request commentdenoland/deno

fix(cli/buffer): allow Buffer to store MAX_SIZE bytes (ALT)

@ry I have a version that's a mixed between the two, that seems to be faster & pretty clean. I'm doing some tests and I'll push it shortly.

marcosc90

comment created time in a month

delete branch marcosc90/deno

delete branch : std-refactor-hex

delete time in a month

push eventmarcosc90/deno

Marcos Casagrande

commit sha d7985674637a9a9ce32653ab364d44f9cce7837c

lint

view details

push time in a month

PR opened denoland/deno

BREAKING(std/encoding/hex): simplify API

this PR proposes a new API for std/encoding/hex

The current implementation is a direct port from Golang but it's a bit weird to have an API return [value, error] in JavaScript instead of throwing the error, aside from this being the only API in Deno that is doing that.

current API

const src = new Uint8Array([1,2,3]);
const dst = new Uint8Array(encodedLen(src.length));
const n = encode(src, dst);

proposed API

const src = new Uint8Array([1,2,3]);
const dst = encode(src);

decodeString & encodeToString are unchanged.

+46 -108

0 comment

2 changed files

pr created time in a month

delete branch marcosc90/deno

delete branch : fix-wasi-example

delete time in a month

delete branch marcosc90/deno

delete branch : fix-body-max-call-stack

delete time in a month

delete branch marcosc90/deno

delete branch : std-buffer-encoding

delete time in a month

delete branch marcosc90/deno

delete branch : fix-5974-null-body-status

delete time in a month

delete branch marcosc90/deno

delete branch : fetch-redirect-error

delete time in a month

pull request commentdenoland/deno

fix(cli/buffer): allow Buffer to store MAX_SIZE bytes (ALT)

@marcosc90 which PR do you prefer?

I prefer #6568, it is a cleaner implementation IMHO.

I'd like to run some benchmarks. This one (#6570) might be a bit faster since we avoid an extra buf.set, it reads directly into the buffer. The exception is when it grows the buffer when it's not needed, that happens when there are less than MIN_READ bytes remaining.

marcosc90

comment created time in a month

delete branch marcosc90/deno

delete branch : write-text-file-options

delete time in a month

delete branch marcosc90/deno

delete branch : body-concatenate-perf

delete time in a month

create barnchmarcosc90/deno

branch : std-refactor-hex

created branch time in a month

delete branch marcosc90/deno

delete branch : fix-base64-worker-scopes

delete time in a month

PR opened denoland/deno

fix(std): base64 in workers

Similar to #6662

File: main.ts

new Worker(new URL('worker.ts', import.meta.url).href);

File: worker.ts

import { encode } from 'https://deno.land/std/encoding/base64.ts'
console.log(encode('hi'))

Throws:

error: Uncaught Error: TS2304 [ERROR]: Cannot find name 'window'.
    return window.btoa(data);
+3 -3

0 comment

1 changed file

pr created time in a month

create barnchmarcosc90/deno

branch : fix-base64-worker-scopes

created branch time in a month

Pull request review commentdenoland/deno

refactor: cli/js

 import { AbortSignalImpl, signalAbort } from "./abort_signal.ts";  export class AbortControllerImpl implements AbortController {-  #signal = new AbortSignalImpl();--  get signal(): AbortSignal {-    return this.#signal;-  }+  readonly signal = new AbortSignalImpl();    abort(): void {-    this.#signal[signalAbort]();+    this.signal[signalAbort]();

This changes the behavior, now it's possible to do:

const signal = new AbortController();
signal.signal = 5;
signal.signal === 5; // true
stanislavstrelnikov

comment created time in a month

Pull request review commentdenoland/deno

refactor: cli/js

 import { ReadableStreamImpl } from "./streams/readable_stream.ts";  export const bytesSymbol = Symbol("bytes"); -export function containsOnlyASCII(str: string): boolean {-  if (typeof str !== "string") {+export function containsOnlyASCII(s: string): boolean {

While I agree with many of the changes, a lot of them seem arbitrary and based on your personal preference, is there a code style that we're following that justify these changes?

stanislavstrelnikov

comment created time in a month

Pull request review commentdenoland/deno

refactor: cli/js

 export class URLImpl implements URL {    constructor(url: string | URL, base?: string | URL) {     let baseParts: URLParts | undefined;-    if (base) {+    if (base != null) {

What's the reason behind these changes? I for one prefer the current way, the intent is clear, you expect a truthy value, on the other hand when using != null it can either be a bug (=== should be used) or you expect a truthy value.

Is there a style guide?

stanislavstrelnikov

comment created time in a month

PR opened denoland/deno

perf(cli/body): improve .arrayBuffer() speed

Use content-length header if available to grow the Buffer to avoid extra allocations & copies.

+48 -23

0 comment

5 changed files

pr created time in a month

push eventmarcosc90/deno

Marcos Casagrande

commit sha 414ab5fca3efa28c5fa388aa4179ecabf49b75a3

perf(cli/body): improve .arrayBuffer() speed

view details

push time in a month

create barnchmarcosc90/deno

branch : body-concatenate-perf

created branch time in a month

Pull request review commentdenoland/deno

[WIP] Add node/string_decoder and some more

+//TODO@Soremwar+//Definetely stilize this+//Add tests+//Add types+// Copyright Joyent, Inc. and other Node contributors.+//+// 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+// without limitation the rights to use, copy, modify, merge, publish,+// distribute, sublicense, and/or sell copies of the Software, and to permit+// persons to whom the Software is furnished to do so, subject to the+// following conditions:+//+// The above copyright notice and this permission notice shall be included+// in all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE+// USE OR OTHER DEALINGS IN THE SOFTWARE.+import { Buffer } from "./buffer.ts";++const isEncoding =+  Buffer.isEncoding ||+  function (encoding) {+    encoding = "" + encoding;+    switch (encoding && encoding.toLowerCase()) {+      case "hex":+      case "utf8":+      case "utf-8":+      case "base64":+      case "raw":+        return true;+      default:+        return false;+    }+  };++function _normalizeEncoding(enc) {

We should use https://github.com/denoland/deno/blob/2fe315bfb1f8fc80e7e4e353414eb9bfa58c059f/std/node/_utils.ts#L52

And throw notImplemented not implemented encodings, to prevent having normalizeEncoding in every module

Soremwar

comment created time in a month

delete branch marcosc90/deno

delete branch : fix-response-default-status

delete time in a month

issue commentdenoland/deno

thread 'main' panicked on TextDecoder().decode()

Was there a real situation where you ran into this?

A friend was trying to parse a large CSV (~600MB) using Deno.readTextFile('./large.csv') and got the error. We can all agree that a Reader should be used in this case, but it's not uncommon to see scripts that load everything into memory.

We could check in advance the byte length before sending it in the op, but it would be difficult to split it across multiple ops

Throwing a better error until a more robust solution is in place I think it's a step in the right direction.

marcosc90

comment created time in a month

PR opened denoland/deno

fix(cli/fetch): response constructor default properties

Fix bug in Response constructor .status and set false as default value for .redirected

+44 -36

0 comment

2 changed files

pr created time in a month

create barnchmarcosc90/deno

branch : fix-response-default-status

created branch time in a month

issue openeddenoland/deno

thread 'main' panicked on TextDecoder().decode()

When decoding a big buffer Deno crashes.

new TextDecoder().decode(new Uint8Array(2 ** 29).fill(0))
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', core/bindings.rs:677:5
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1069
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1504
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:198
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:218
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:511
  11: rust_begin_unwind
             at src/libstd/panicking.rs:419
  12: core::panicking::panic_fmt
             at src/libcore/panicking.rs:111
  13: core::panicking::panic
             at src/libcore/panicking.rs:54
  14: deno_core::bindings::decode
  15: <extern "C" fn(A0) .> R as rusty_v8::support::CFnFrom<F>>::mapping::c_fn
  16: _ZN2v88internal25FunctionCallbackArguments4CallENS0_15CallHandlerInfoE
             at ../../../../v8/src/api/api-arguments-inl.h:158
  17: _ZN2v88internal12_GLOBAL__N_119HandleApiCallHelperILb0EEENS0_11MaybeHandleINS0_6ObjectEEEPNS0_7IsolateENS0_6HandleINS0_10HeapObjectEEESA_NS8_INS0_20FunctionTemplateInfoEEENS8_IS4_EENS0_16BuiltinArgumentsE
             at ../../../../v8/src/builtins/builtins-api.cc:111
  18: _ZN2v88internalL26Builtin_Impl_HandleApiCallENS0_16BuiltinArgumentsEPNS0_7IsolateE
             at ../../../../v8/src/builtins/builtins-api.cc:141
  19: Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
fatal runtime error: failed to initiate panic, error 5
Aborted (core dumped

The snippet returns "" on Chrome


Deno version: 1.1.3

created time in a month

delete branch marcosc90/deno

delete branch : body-concatenate-buffer

delete time in a month

PR opened denoland/deno

feat(std/node): add buf.equals method

This PR adds buf.equals(otherBuffer) to std/node/buffer

+50 -0

0 comment

2 changed files

pr created time in a month

create barnchmarcosc90/deno

branch : std-node-buffer-equals

created branch time in a month

push eventmarcosc90/deno

Marcos Casagrande

commit sha 3b1b62e2cc224917d3e34391433d72b0a3919715

fix(std/node): add encoding argument to Buffer.byteLength

view details

push time in a month

PR opened denoland/deno

fix(std/node): add encoding argument to Buffer.byteLength

Added encoding support to Buffer.byteLength

Tests taken directly from Node: https://github.com/nodejs/node/blob/56dbe466fdbc598baea3bfce289bf52b97b8b8f7/test/parallel/test-buffer-bytelength.js#L70

+91 -3

0 comment

2 changed files

pr created time in a month

create barnchmarcosc90/deno

branch : std-node-buffer-bytelength

created branch time in a month

PR opened denoland/deno

refactor(cli/body): use Deno.Buffer in bufferFromStream

Reduced memory usage of body.arrayBuffer():

Type Body Size RSS
Buffer 100MB 313.94MB
Array 100MB 358.89MB
Buffer 500MB 1065.02MB
Array 500MB 1696.13MB
Buffer 1800MB 3733.58MB
Array 1800MB 6029.67MB

Measured using /usr/bin/time --verbose deno run script.ts


Depends on #6568 or #6570 in order to work for body sizes > 2gb

+7 -19

0 comment

1 changed file

pr created time in a month

create barnchmarcosc90/deno

branch : body-concatenate-buffer

created branch time in a month

issue commentdenoland/deno

signals not blocking always

I understand the logic behind not blocking and I agree with it, but I feel like we should provide a way to block that is less hacky than creating a setInterval. Maybe add a .ref method if signals are .unref'd by default, or the other way around if that's what the majority prefers

Similar to https://github.com/denoland/deno/issues/6141

aricart

comment created time in a month

Pull request review commentdenoland/deno

fix(cli/buffer): allow Buffer to store MAX_SIZE bytes

 import {   unitTest, } from "./test_util.ts"; +const MAX_SIZE = 2 ** 32 - 2;

I can replicate the crash on master using write/writeSync when writing ~2gb, but not for readFrom, the latter always allocate a maximum buffer of 4294966784, 510 bytes short of MAX_SIZE

const buf = new Deno.Buffer()
buf.writeSync(repeat("x", 2147483647));
buf.writeSync(repeat("x", 1));
// throws The buffer cannot be grown beyond the maximum size.

readFrom/Sync

const reader = new Deno.Buffer(new ArrayBuffer(4294966784 + 1));
const buf = new Deno.Buffer();
buf.readFromSync(reader);
// throws The buffer cannot be grown beyond the maximum size.
marcosc90

comment created time in a month

push eventmarcosc90/deno

Marcos Casagrande

commit sha 7d717db18d33a428c1dcd9d33d410d6911119a8c

Ignore test in low-memory environments

view details

push time in a month

pull request commentdenoland/deno

fix(cli/buffer): allow Buffer to store MAX_SIZE bytes

Ignored tests in low memory environments:

Windows:

test bufferGrowWriteMaxBuffer ... ignored (0ms)
test bufferGrowReadSyncCloseToMaxBuffer ... ignored (0ms)
test bufferGrowReadCloseToMaxBuffer ... ignored (0ms)
test bufferGrowReadCloseMaxBufferPlus1 ... ignored (0ms)
test bufferGrowReadSyncCloseMaxBufferPlus1 ... ignored (0ms)
test bufferReadCloseToMaxBufferWithInitialGrow ... ignored (0ms)

Linux and Mac

....
test bufferGrowReadCloseMaxBufferPlus1 ... ok (8697ms)
test bufferGrowReadSyncCloseMaxBufferPlus1 ... ok (9522ms)
test bufferReadCloseToMaxBufferWithInitialGrow ... ok (16614ms)
....
marcosc90

comment created time in a month

push eventmarcosc90/deno

Marcos Casagrande

commit sha 31bcee5b792e82d151935f22c9e013958d7c1999

Ignore test in low-memory environments

view details

push time in a month

issue commentdenoland/deno

can not visit in china : https://deno.land/std/http/server.ts

You can use import it from github directly: https://raw.githubusercontent.com/denoland/deno/std/0.59.0/std/http/server.ts

bit-work

comment created time in a month

pull request commentdenoland/deno

fix(cli/buffer): allow Buffer to store MAX_SIZE bytes

In Windows, it seems the ArrayBuffer hard limit is different, so it can be tested correctly.

RangeError: Array buffer allocation failed
    at new ArrayBuffer (<anonymous>)

Or maybe the CI windows instance has less memory.

marcosc90

comment created time in a month

push eventmarcosc90/deno

Marcos Casagrande

commit sha 6a842f451ced748b6bf47e27c4139a497beb98b5

allow buffer to store MAX_VALUE bytes

view details

push time in a month

Pull request review commentdenoland/deno

fix(cli/buffer): allow Buffer to store MAX_SIZE bytes

 export class Buffer implements Reader, ReaderSync, Writer, WriterSync {    async readFrom(r: Reader): Promise<number> {     let n = 0;+    const buf = new Uint8Array(32 * 1024);

Posted alternative implementation in #6570

marcosc90

comment created time in a month

PR opened denoland/deno

fix(cli/buffer): allow Buffer to store MAX_SIZE bytes (ALT)

fixes #6543.

This is an alternative implementation of #6568

+112 -8

0 comment

2 changed files

pr created time in a month

push eventmarcosc90/deno

Marcos Casagrande

commit sha 1bbeac5e370498e1fff1a6b24821d47dc0596e56

allow buffer to store MAX_VALUE bytes

view details

push time in a month

push eventmarcosc90/deno

Marcos Casagrande

commit sha fab2e069b8c9cf9552f8b778ebc1bdc164d939d7

Add tests

view details

push time in a month

push eventmarcosc90/deno

Marcos Casagrande

commit sha 49229db3c647334d0ac3f8c5312c7b45a9ffa62b

Lint

view details

push time in a month

create barnchmarcosc90/deno

branch : fix-buffer-grow-alt

created branch time in a month

Pull request review commentdenoland/deno

fix(cli/buffer): allow Buffer to store MAX_SIZE bytes

 export class Buffer implements Reader, ReaderSync, Writer, WriterSync {    async readFrom(r: Reader): Promise<number> {     let n = 0;+    const buf = new Uint8Array(32 * 1024);

calling this.#grow without knowing the actual amount that needs to grow is causing troubles, went with the simpler and less error-prone code, which is calling writeSync which calls this.#grow with the size of the read buffer.

In a few minutes, I'll push an alternative reading directly to the buffer (which is not as clean). If someone else wants to try I'm more than happy.

marcosc90

comment created time in a month

PR opened denoland/deno

fix(cli/buffer): allow Buffer to store MAX_SIZE bytes

fixes #6543

+62 -13

0 comment

2 changed files

pr created time in a month

push eventmarcosc90/deno

Marcos Casagrande

commit sha f6b9bdd49f892ff87a6f086a2059243a95922a7b

allow buffer to store MAX_VALUE bytes

view details

push time in a month

issue commentoakserver/oak

add array of middleware in router

Indeed @kitsonk wasn't aware of it. I'll archive my fork of koa-compose.

fauzan121002

comment created time in a month

push eventmarcosc90/deno

Marcos Casagrande

commit sha 06bee2c983d78c267a98bc203bfb1a6c89aec062

allow buffer to store MAX_VALUE bytes

view details

push time in a month

push eventmarcosc90/oak-compose

Marcos Casagrande

commit sha 3414ea4c8021861b04f8a7ed976e0c3cc756897d

Adapt to Deno - Oak

view details

push time in a month

fork marcosc90/compose

Middleware composition utility

fork in a month

more