@sanity/export
Advanced tools
| import { Transform } from 'node:stream'; | ||
| import { StringDecoder } from 'node:string_decoder'; | ||
| export function through(transformFn) { | ||
@@ -49,6 +50,7 @@ return new Transform({ | ||
| const splitRegex = /\r?\n/; | ||
| const decoder = new StringDecoder('utf8'); | ||
| return new Transform({ | ||
| objectMode: Boolean(transformFn), | ||
| transform(chunk, _encoding, callback) { | ||
| buffer += chunk.toString(); | ||
| buffer += decoder.write(chunk); | ||
| const lines = buffer.split(splitRegex); | ||
@@ -79,2 +81,4 @@ // Keep the last line in buffer as it might be incomplete | ||
| flush(callback) { | ||
| // Flush any remaining bytes from the decoder | ||
| buffer += decoder.end(); | ||
| if (buffer.length === 0) { | ||
@@ -81,0 +85,0 @@ callback(); |
+1
-1
| MIT License | ||
| Copyright (c) 2025 - 2024 Sanity.io | ||
| Copyright (c) 2026 - 2024 Sanity.io | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
+1
-1
| { | ||
| "name": "@sanity/export", | ||
| "version": "6.0.2", | ||
| "version": "6.0.3", | ||
| "description": "Export Sanity documents and assets", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
| import {Transform, type TransformCallback, type Writable} from 'node:stream' | ||
| import {StringDecoder} from 'node:string_decoder' | ||
@@ -69,2 +70,3 @@ type TransformFunction = ( | ||
| const splitRegex = /\r?\n/ | ||
| const decoder = new StringDecoder('utf8') | ||
@@ -74,3 +76,3 @@ return new Transform({ | ||
| transform(chunk: Buffer, _encoding: BufferEncoding, callback: TransformCallback) { | ||
| buffer += chunk.toString() | ||
| buffer += decoder.write(chunk) | ||
| const lines = buffer.split(splitRegex) | ||
@@ -101,2 +103,5 @@ | ||
| flush(callback: TransformCallback) { | ||
| // Flush any remaining bytes from the decoder | ||
| buffer += decoder.end() | ||
| if (buffer.length === 0) { | ||
@@ -103,0 +108,0 @@ callback() |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
190414
0.28%3489
0.23%0
-100%