mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-13 01:54:52 +08:00
Set the size of a chunk to Number.MAX_VALUE to get the whole file at once and parse it. Removed all the states we had for reading the file and logic for reading it in chunks. Bug: 313757110 Change-Id: I9fe7ea3517a16517e85582e0d6009d9c032862b1 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5382164 Commit-Queue: Alina Varkki <alinavarkki@chromium.org> Reviewed-by: Paul Irish <paulirish@chromium.org>
27 lines
599 B
TypeScript
27 lines
599 B
TypeScript
// Copyright 2015 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
export interface OutputStream {
|
|
write(data: string, endOfFile?: boolean): Promise<void>;
|
|
close(): Promise<void>;
|
|
}
|
|
|
|
export class StringOutputStream implements OutputStream {
|
|
#dataInternal: string;
|
|
constructor() {
|
|
this.#dataInternal = '';
|
|
}
|
|
|
|
async write(chunk: string): Promise<void> {
|
|
this.#dataInternal += chunk;
|
|
}
|
|
|
|
async close(): Promise<void> {
|
|
}
|
|
|
|
data(): string {
|
|
return this.#dataInternal;
|
|
}
|
|
}
|