Skip to content

Commit

Permalink
Merge a796fed into 5fadcc6
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S committed Dec 24, 2019
2 parents 5fadcc6 + a796fed commit 4d58017
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions packages/cspell-trie/bin.js
@@ -0,0 +1,5 @@
#!/usr/bin/env node

'use strict';

require('./dist/app');
5 changes: 3 additions & 2 deletions packages/cspell-trie/package.json
@@ -1,11 +1,12 @@
{
"name": "cspell-trie",
"version": "4.1.8",
"description": "Trie Data Structure and tools to support cspell.",
"bin": "./dist/app.js",
"description": "Trie Data Structure reader for cspell",
"bin": "bin.js",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"bin.js",
"dist/**",
"!**/*.map",
"!**/*.test.*"
Expand Down
7 changes: 4 additions & 3 deletions packages/cspell-trie/src/app.ts
Expand Up @@ -8,6 +8,8 @@ import * as path from 'path';
import * as Trie from 'cspell-trie-lib';
import { Sequence, genSequence } from 'gensequence';
import { iterableToStream } from 'iterable-to-stream';
import * as zlib from 'zlib';


const UTF8: BufferEncoding = 'utf8';

Expand Down Expand Up @@ -76,7 +78,8 @@ if (!commander.args.length) {
}

async function fileToLines(filename: string): Promise<Sequence<string>> {
const file = await fs.readFile(filename, UTF8);
const buffer = await fs.readFile(filename);
const file = (filename.match(/\.gz$/) ? zlib.gunzipSync(buffer) : buffer).toString(UTF8);
return genSequence(file.split(/\r?\n/));
}

Expand All @@ -93,5 +96,3 @@ function notify(message: any, useStdOut = true) {
console.error(message);
}
}


0 comments on commit 4d58017

Please sign in to comment.