@nteract/sift-csv 0.0.1 → 0.1.1-nightly.38539867587

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,13 +1,48 @@
1
- # @nteract/sift-csv 0.0.1
1
+ # @nteract/sift-csv
2
2
 
3
- This version only reserves the package name so nteract's release workflow can
4
- publish through npm trusted publishing. It contains no code.
3
+ CSV and TSV to Arrow IPC, in WebAssembly. Published as
4
+ [`@nteract/sift-csv`](https://www.npmjs.com/package/@nteract/sift-csv). Built for
5
+ [`@nteract/sift`](https://www.npmjs.com/package/@nteract/sift), usable by any
6
+ Arrow consumer. Pin an exact version; the package is pre-1.0.
5
7
 
6
- Install a real build instead:
8
+ ```ts
9
+ import { csvToArrowIpc } from '@nteract/sift-csv'
10
+ import { loadTableFile } from '@nteract/sift'
7
11
 
8
- ```sh
9
- npm install --save-exact @nteract/sift-csv@nightly
12
+ const ipc = await csvToArrowIpc(text, { delimiter: '\t' })
13
+ const data = await loadTableFile(ipc, { format: 'arrow-ipc' })
10
14
  ```
11
15
 
12
- Stable versions publish to `latest` from the nteract release workflow. See
13
- https://github.com/nteract/nteract/tree/main/packages/sift-csv.
16
+ It is a separate package so apps that only open Parquet or Arrow do not carry
17
+ the CSV parser: the WASM is about 2 MB (590 KB gzipped).
18
+
19
+ ## Behavior
20
+
21
+ - Type inference reads the whole file. Booleans (`true`/`false`, any case),
22
+ Int64, Float64 (including exponents), ISO Date32, and ISO Timestamp columns
23
+ are detected. A column with mixed shapes is text.
24
+ - Empty fields are null in every column type.
25
+ - Files load whole or fail. Ragged rows, unbalanced quotes, and limit breaches
26
+ reject with the reason; nothing is truncated or sampled.
27
+ - Defaults: 16 MiB input, 100,000 rows, 256 columns, 128 MiB of Arrow output.
28
+ Every limit is an option.
29
+
30
+ ## WASM asset
31
+
32
+ `lib/wasm/sift_csv_wasm_bg.wasm` is resolved next to the glue through
33
+ `import.meta.url`. When a bundler or iframe moves it, point at the binary first:
34
+
35
+ ```ts
36
+ import { setWasmUrl } from '@nteract/sift-csv'
37
+ setWasmUrl(new URL('@nteract/sift-csv/wasm', import.meta.url))
38
+ ```
39
+
40
+ ## Development
41
+
42
+ ```sh
43
+ cargo xtask wasm sift-csv # crates/sift-csv-wasm/pkg
44
+ pnpm --dir packages/sift-csv test
45
+ pnpm --dir packages/sift-csv build:lib
46
+ pnpm --dir packages/sift-csv test:package
47
+ cargo test -p sift-csv-wasm
48
+ ```
package/lib/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2024, runtimed
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.