ogr2ogr
Version:
ogr2ogr wrapper w/ multiple format support
52 lines (49 loc) • 1.49 kB
text/typescript
import { Stream, Readable } from 'stream';
type JSONLike = Record<string, unknown>;
type Input = string | JSONLike | Stream;
interface Result {
cmd: string;
text: string;
data?: JSONLike;
stream?: Readable;
extname?: string;
details: string;
}
type Callback = (err: Error | null, res?: Result) => void;
interface Options {
command?: string;
format?: string;
inputFormat?: string;
options?: string[];
destination?: string;
env?: Record<string, string>;
timeout?: number;
maxBuffer?: number;
skipFailures?: boolean;
}
declare class Ogr2ogr implements PromiseLike<Result> {
private inputStream?;
private inputPath;
private outputPath;
private outputFormat;
private outputExt;
private customCommand?;
private customOptions?;
private customDestination?;
private customEnv?;
private timeout;
private maxBuffer;
private skipFailures;
constructor(input: Input, opts?: Options);
exec(cb: Callback): void;
then<TResult1 = Result, TResult2 = never>(onfulfilled?: (value: Result) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: string) => TResult2 | PromiseLike<TResult2>): PromiseLike<TResult1 | TResult2>;
private newInputPath;
private newOutputPath;
private createZipStream;
private run;
}
declare function ogr2ogr(input: Input, opts?: Options): Ogr2ogr;
declare namespace ogr2ogr {
var version: () => Promise<string>;
}
export { ogr2ogr };