node: >=0.12
to node: >=8
to keep up with mandatory ecosystem changesFixed a readme documentation inconsistency
Fixed node v0.12 and v4 support (regression since v2.5.0)
As the detection algorithms are result returns, with the asynchronous signatures just wrappers, we have changed isText
, isBinary
, and getEncoding
to return the result if no callback was provided to them, maintaining backwards compatibility, but encouraging intuitive usage of the methods with the least overhead.
The following methods have had return signatures added to them, which should be the preferable usage:
isText
, which you should use instead of isTextSync
(a method which only lingers for backwards compatibility)isBinary
, which you should use instead of isBinarySync
(a method which only lingers for backwards compatibility)getEncoding
, which you should use instead of getEncoding
(a method which only lingers for backwards compatibility)If you require callback usage, the following callback wrapper methods have been added:
isTextCallback
, which you should use instead of isText
's callback signature (a signature which only lingers for backwards compatibility)isBinaryCallback
, which you should use instead of isBinary
's callback signature (a signature which only lingers for backwards compatibility)getEncodingCallback
, which you should use instead of getEncoding
's callback signature (a signature which only lingers for backwards compatibility)If you require promise usage, the following promise wrapper methods have been added:
isTextPromise
which wraps isText
with a promise signatureisBinaryPromise
which wraps isBinary
with a promise signaturegetEncodingPromise
which wraps getEncoding
with a promise signatureisBinary
method now correctly returns null
instead of true
when no inputs are provided
Added tests for all methods
package.json
try...catch
the synchronous methods to ensure an error from invalid inputs would be given to the callback.
try...catch
so if invalid inputs were given, the error would throw.getEncoding
callback was a boolean, this was incorrect, it would be the string result of getEncodingSync
.package.json
error
getEncoding
and isText
not handling errors correctly