Options
All
  • Public
  • Public/Protected
  • All
Menu

Module parser-core

Index

Type aliases

ActionEnum

ActionEnum: { PARSER: ParserAction; READ_ITEMS: ParserAction; UNZIP: ParserAction }

Type declaration

BaseBook

BaseBook: BaseBook

BaseItem

BaseItem: BaseItem

BaseItemParam

BaseItemParam: { size: number }

Type declaration

  • size: number

BaseParseContext

BaseParseContext: BaseParseContext

BaseParserOption

BaseParserOption: { overwrite: boolean; unzipPath: string }

Type declaration

  • overwrite: boolean

    If true, overwrite to unzipPath when unzip. (only using if unzipPath specified.)

  • unzipPath: string

    If specified, unzip to that path.

BaseParserOption

BaseParserOption: { overwrite: boolean; unzipPath: string }

Type declaration

  • overwrite: boolean

    If true, overwrite to unzipPath when unzip. (only using if unzipPath specified.)

  • unzipPath: string

    If specified, unzip to that path.

BaseParserOptionType

BaseParserOptionType: { overwrite: string; unzipPath: string }

Type declaration

  • overwrite: string

    /

    /**

  • unzipPath: string

BaseParserOptionType

BaseParserOptionType: { overwrite: string; unzipPath: string }

Type declaration

  • overwrite: string

    /

    /**

  • unzipPath: string

BaseReadContext

BaseReadContext: BaseReadContext

BaseReadOption

BaseReadOption: { force: boolean }

Type declaration

  • force: boolean

BaseReadOption

BaseReadOption: { force: boolean }

Type declaration

  • force: boolean

BaseReadOptionType

BaseReadOptionType: { force: string }

Type declaration

  • force: string

BaseReadOptionType

BaseReadOptionType: { force: string }

Type declaration

  • force: string

CryptoProviderOption

CryptoProviderOption: string

CryptoProviderPurpose

CryptoProviderPurpose: { READ_IN_DIR: CryptoProviderOption; READ_IN_ZIP: CryptoProviderOption; WRITE: CryptoProviderOption }

Type declaration

DecodeFunction

DecodeFunction: (uint8ArrayOrBufferOrArray: IterableObject) => CryptoJs.lib.WordArray

Type declaration

    • Parameters

      Returns CryptoJs.lib.WordArray

EncodeFunction

EncodeFunction: (wordArray: CryptoJs.lib.WordArray) => Uint8Array

Type declaration

    • (wordArray: CryptoJs.lib.WordArray): Uint8Array
    • Parameters

      • wordArray: CryptoJs.lib.WordArray

      Returns Uint8Array

EncodingList

EncodingList: { BUFFER: EncodingObject; HEX: EncodingObject; UINT8: EncodingObject; UTF8: EncodingObject }

Type declaration

EncodingObject

EncodingObject: { decode: (str: string | IterableObject) => CryptoJs.lib.WordArray; encode: (wordArray: CryptoJs.lib.WordArray) => string | Uint8Array; name: string }

Type declaration

  • decode: (str: string | IterableObject) => CryptoJs.lib.WordArray
  • encode: (wordArray: CryptoJs.lib.WordArray) => string | Uint8Array
      • (wordArray: CryptoJs.lib.WordArray): string | Uint8Array
      • Parameters

        • wordArray: CryptoJs.lib.WordArray

        Returns string | Uint8Array

  • name: string

EntryBasicInformation

EntryBasicInformation: { entryPath: string; getFile: (options: { end: number; endocing: string }) => Promise<Buffer> | Buffer; size: number }

Type declaration

  • entryPath: string
  • getFile: (options: { end: number; endocing: string }) => Promise<Buffer> | Buffer
      • (options: { end: number; endocing: string }): Promise<Buffer> | Buffer
      • Parameters

        • options: { end: number; endocing: string }
          • end: number
          • endocing: string

        Returns Promise<Buffer> | Buffer

  • size: number

ErrorType

ErrorType: { code: string; format: string }

Type declaration

  • code: string
  • format: string

Errors

Errors: { ECRYT: ErrorType; EEXIST: ErrorType; EINTR: ErrorType; EINVAL: ErrorType; ENOATTR: ErrorType; ENOELMT: ErrorType; ENOENT: ErrorType; ENOFILE: ErrorType; ENOIMP: ErrorType; EPDFJS: ErrorType; EREQPRM: ErrorType }

Type declaration

FileEntryObject

FileEntryObject<T, S>: { find: (entryPath: string, strict: boolean) => S; first: S; forEach: (callback: (value: S, index: number, array: S[]) => void) => void; get: (idx: number) => S; length: number; map: (callback: (value: S, index: number, array: S[]) => any) => void; sort: (callback: (a: S, b: S) => number) => void; source: T }

Type parameters

  • T

  • S

Type declaration

  • find: (entryPath: string, strict: boolean) => S
      • (entryPath: string, strict: boolean): S
      • Parameters

        • entryPath: string
        • strict: boolean

        Returns S

  • first: S
  • forEach: (callback: (value: S, index: number, array: S[]) => void) => void
      • (callback: (value: S, index: number, array: S[]) => void): void
      • Parameters

        • callback: (value: S, index: number, array: S[]) => void
            • (value: S, index: number, array: S[]): void
            • Parameters

              • value: S
              • index: number
              • array: S[]

              Returns void

        Returns void

  • get: (idx: number) => S
      • (idx: number): S
      • Parameters

        • idx: number

        Returns S

  • length: number
  • map: (callback: (value: S, index: number, array: S[]) => any) => void
      • (callback: (value: S, index: number, array: S[]) => any): void
      • Parameters

        • callback: (value: S, index: number, array: S[]) => any
            • (value: S, index: number, array: S[]): any
            • Parameters

              • value: S
              • index: number
              • array: S[]

              Returns any

        Returns void

  • sort: (callback: (a: S, b: S) => number) => void
      • (callback: (a: S, b: S) => number): void
      • Parameters

        • callback: (a: S, b: S) => number
            • (a: S, b: S): number
            • Parameters

              • a: S
              • b: S

              Returns number

        Returns void

  • source: T

GetFileOptions

GetFileOptions: { encoding: string; end: number }

Type declaration

  • encoding: string
  • end: number

HashFunction

HashFunction: (any: any, encoding?: EncodingObject) => string

Use Encoding

Type declaration

HashList

HashList: { md5: HashFunction; ripemd160: HashFunction; sha1: HashFunction; sha224: HashFunction; sha256: HashFunction; sha3: HashFunction; sha384: HashFunction; sha512: HashFunction }

Type declaration

IZipEntryPlus

IZipEntryPlus: IZipEntry & EntryBasicInformation & ZipfileEntryInformation

IterableObject

IterableObject: any[] | Uint8Array | Buffer

LogLevel

LogLevel: { DEBUG: string; ERROR: string; INFO: string; SILENT: string; VERBOSE: string; WARN: string }

Type declaration

  • DEBUG: string

    "debug"

  • ERROR: string

    "error"

  • INFO: string

    "info"

  • SILENT: string

    "silent"

  • VERBOSE: string

    "verbose"

  • WARN: string

    "warn"

LoggerOptions

LoggerOptions: { logLevel: LogLevel; namespace: string }

Type declaration

MatchOption

MatchOption: { CONTAINING: number; ENDSWITH: number; MATCHING: number; STARTSWITH: number }

Type declaration

  • CONTAINING: number

    "1"

  • ENDSWITH: number

    "3"

  • MATCHING: number

    "0"

  • STARTSWITH: number

    "2"

ModeConfig

ModeConfig: { iv?: string; key: string }

Type declaration

  • Optional iv?: string
  • key: string

ModeList

ModeList: { CBC: ModeObject; CFB: ModeObject; CTR: ModeObject; ECB: ModeObject; OFB: ModeObject }

Type declaration

ModeObject

ModeObject: { configTypes: ModeConfig; name: string; op: any }

Type declaration

OnProgressCallBack

OnProgressCallBack: (step: number, totalStep: number, action: string) => void

Type declaration

    • (step: number, totalStep: number, action: string): void
    • Parameters

      • step: number
      • totalStep: number
      • action: string

      Returns void

PaddingList

PaddingList: { AUTO: PaddingObject; NONE: PaddingObject; PKCS7: PaddingObject }

Type declaration

PaddingObject

PaddingObject: { name: string; op: PaddingList; pad: (data: CryptoJs.lib.WordArray) => void; unpad: (data: CryptoJs.lib.WordArray) => void }

Type declaration

  • name: string
  • op: PaddingList
  • pad: (data: CryptoJs.lib.WordArray) => void
      • (data: CryptoJs.lib.WordArray): void
      • Parameters

        • data: CryptoJs.lib.WordArray

        Returns void

  • unpad: (data: CryptoJs.lib.WordArray) => void
      • (data: CryptoJs.lib.WordArray): void
      • Parameters

        • data: CryptoJs.lib.WordArray

        Returns void

ParserAction

ParserAction: string

Purpose

Purpose: { READ_IN_DIR: CryptoProviderOption; READ_IN_ZIP: CryptoProviderOption; WRITE: CryptoProviderOption }

Type declaration

ReadEntriesReturnType

ReadEntriesReturnType: { find: (entryPath: string, strict: boolean) => EntryBasicInformation | (IZipEntry & EntryBasicInformation & ZipfileEntryInformation); first: EntryBasicInformation | (IZipEntry & EntryBasicInformation & ZipfileEntryInformation); forEach: (callback: (value: EntryBasicInformation | (IZipEntry & EntryBasicInformation & ZipfileEntryInformation), index: number, array: (EntryBasicInformation | (IZipEntry & EntryBasicInformation & ZipfileEntryInformation))[]) => void) => void; get: (idx: number) => EntryBasicInformation | (IZipEntry & EntryBasicInformation & ZipfileEntryInformation); length: number; map: (callback: (value: EntryBasicInformation | (IZipEntry & EntryBasicInformation & ZipfileEntryInformation), index: number, array: (EntryBasicInformation | (IZipEntry & EntryBasicInformation & ZipfileEntryInformation))[]) => any) => void; sort: (callback: (a: EntryBasicInformation | (IZipEntry & EntryBasicInformation & ZipfileEntryInformation), b: EntryBasicInformation | (IZipEntry & EntryBasicInformation & ZipfileEntryInformation)) => number) => void; source: string }

Type declaration

Task

Task: { fun: Function; name: string }

Type declaration

  • fun: Function

    Action executor

  • name: string

    Action name

UINT8Object

UINT8Object: { decode: DecodeFunction; encode: EncodeFunction }

Type declaration

ZipFileInformation

ZipFileInformation: { cryptoProvider: CryptoProvider; extractAll: (unzipPath: string, overwrite?: boolean) => Promise<any>; file: string; files: any[]; find: (entryPath: string) => any; getFile: (entry: any, options?: GetFileOptions) => Promise<Buffer | string>; logger: Logger }

Type declaration

  • cryptoProvider: CryptoProvider
  • extractAll: (unzipPath: string, overwrite?: boolean) => Promise<any>
      • (unzipPath: string, overwrite?: boolean): Promise<any>
      • Parameters

        • unzipPath: string
        • Optional overwrite: boolean

        Returns Promise<any>

  • file: string
  • files: any[]
  • find: (entryPath: string) => any
      • (entryPath: string): any
      • Parameters

        • entryPath: string

        Returns any

  • getFile: (entry: any, options?: GetFileOptions) => Promise<Buffer | string>
      • Parameters

        Returns Promise<Buffer | string>

  • logger: Logger

ZipfileEntryInformation

ZipfileEntryInformation: { extraFieldLength: number; method: string }

Type declaration

  • extraFieldLength: number
  • method: string

Variables

Const Action

Action: ActionEnum
readonly

Const Encoding

Encoding: EncodingList

Const Errors

Errors: Errors

Const Hash

Hash: HashList

Const LogLevel

LogLevel: Readonly<{ DEBUG: string; ERROR: string; INFO: string; SILENT: string; VERBOSE: string; WARN: string }>

Const MatchOption

MatchOption: MatchOption

Const Mode

Mode: ModeList

Const Padding

Padding: PaddingList

Const Purpose

Purpose: Readonly<{ READ_IN_DIR: string; READ_IN_ZIP: string; WRITE: string }>

Functions

conditionally

  • conditionally(condition: boolean | (() => boolean), stream: MapStream): MapStream
  • Apply event stream conditionally

    Parameters

    • condition: boolean | (() => boolean)
    • stream: MapStream

    Returns MapStream

    Mapstream

createCryptoStream

  • createCryptoStream(filePath: string, totalSize: number, cryptoProvider: CryptoProvider, purpose: string): MapStream
  • Parameters

    • filePath: string
    • totalSize: number
    • cryptoProvider: CryptoProvider
    • purpose: string

    Returns MapStream

createError

  • createError(type: ErrorType, ...args: string[]): Error
  • Create error

    Parameters

    Returns Error

createSliceStream

  • createSliceStream(start?: number, end?: number): MapStream
  • Parameters

    • Optional start: number
    • Optional end: number

    Returns MapStream

getCachePath

  • getCachePath(): string
  • Get path to store cache

    Returns string

    Path of a temp directory

getPathes

  • getPathes(target: string): string[]
  • Parameters

    • target: string

    Returns string[]

getType

  • getType(any: any, strict?: boolean): string
  • Get type as string

    Parameters

    • any: any
    • Optional strict: boolean

    Returns string

isArray

  • isArray(any: any): boolean
  • Return true if passed argument is an array

    Parameters

    • any: any

    Returns boolean

isBool

  • isBool(any: any): boolean
  • Return true if passed argument is a boolean

    Parameters

    • any: any

    Returns boolean

isExists

  • isExists(any: any): boolean
  • Return true if passed argument is undefined nor null

    Parameters

    • any: any

    Returns boolean

isFunc

  • isFunc(any: any): boolean
  • Return true if passed argument is function

    Parameters

    • any: any

    Returns boolean

isObject

  • isObject(any: any): boolean
  • Return true if passed argument is object

    Parameters

    • any: any

    Returns boolean

isString

  • isString(any: any): boolean
  • Return true if passed argument is string

    Parameters

    • any: any

    Returns boolean

isUrl

  • isUrl(string: any): boolean
  • Return true if passed argument is url

    Parameters

    • string: any

    Returns boolean

mergeObjects

  • mergeObjects<T, S, K>(obj1: T, obj2: S): K
  • Merge Objects

    template

    Type parameters

    • T

    • S

    • K

    Parameters

    • obj1: T
    • obj2: S

    Returns K

    merged object

mustOverride

  • mustOverride(): Error
  • Create MustOverride error

    Returns Error

openZip

  • throws

    {Errors.ENOENT} When file can't be found

    Parameters

    Returns ZipFileInformation

parseBool

  • parseBool(any: any): boolean
  • Return boolean form of any input

    Parameters

    • any: any

    Returns boolean

readCacheFile

  • readCacheFile(key: string): string | null
  • Read the cache file with a key

    Parameters

    • key: string

      Key of a cache file

    Returns string | null

    null if cache does not exists, string otherwise

readEntries

removeAllCacheFiles

  • removeAllCacheFiles(): void
  • Remove every cache file

    Returns void

removeCacheFile

  • removeCacheFile(key: string): void
  • Remove the cache file with a key

    Parameters

    • key: string

      Key of a cache file

    Returns void

safeDecodeURI

  • safeDecodeURI(uri: string): string
  • Decode URI

    Parameters

    • uri: string

    Returns string

safeDirname

  • safeDirname(target: string): string
  • Parameters

    • target: string

    Returns string

safePath

  • safePath(target: string): string
  • Parameters

    • target: string

    Returns string

safePathJoin

  • safePathJoin(...components: string[]): string
  • Parameters

    • Rest ...components: string[]

    Returns string

stringContains

  • stringContains(array?: string[], string?: string, matchOption?: MatchOption): boolean
  • Parameters

    • Optional array: string[]
    • Optional string: string
    • Optional matchOption: MatchOption

    Returns boolean

trim

  • trim(buffer: Buffer): Buffer
  • Trim a buffer

    Parameters

    • buffer: Buffer

    Returns Buffer

    Trimmed buffer

trimEnd

  • trimEnd(buffer: Buffer): Buffer
  • Removes all the trailing non zero buffer chunk

    Parameters

    • buffer: Buffer

    Returns Buffer

    Trimmed buffer

trimStart

  • trimStart(buffer: Buffer): Buffer
  • Removes all the leading non zero buffer chunk

    Parameters

    • buffer: Buffer

    Returns Buffer

    Trimmed buffer

validateOptions

  • validateOptions<T, S>(options: T, types: S, strict?: boolean): void
  • Validate option with interface. it will return void if it passes, throw error otherwise.

    template

    S

    Type parameters

    • T

    • S

    Parameters

    • options: T
    • types: S
    • Optional strict: boolean

    Returns void

writeCacheFile

  • writeCacheFile(key: string, message: string | NodeJS.ArrayBufferView, overwrite?: boolean): void
  • Write cache file

    Parameters

    • key: string

      Key of a cache file

    • message: string | NodeJS.ArrayBufferView

      Message to store

    • Optional overwrite: boolean

    Returns void

Generated using TypeDoc