Skip to content

The optional parameter "charset" is not set by default #3

@razvanionescu

Description

@razvanionescu

According to the API, the charset parameter should be optional, when calling the extractCommentsFromFile function.
But, feeding an "us-ascii" / "utf-8" file to this function, without passing "{charset:'utf-8'}" as a parameter, returns an "ERR_UNKNOWN_ENCODING TypeError".

So:
commentList = commentExtractor.extractCommentsFromFile('/path/to/file.js',{charset:'utf-8'}); - works
but
commentList = commentExtractor.extractCommentsFromFile('/path/to/file.js'); throws:
UnhandledPromiseRejectionWarning: TypeError [ERR_UNKNOWN_ENCODING]: Unknown encoding: null
at stringSlice (buffer.js:630:9)
at Buffer.toString (buffer.js:666:10)
[...]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions