istextorbinary v2.5.0 Release Notes
Release Date: 2019-01-21 // over 5 years ago-
As the detection algorithms are result returns, with the asynchronous signatures just wrappers, we have changed
isText
,isBinary
, andgetEncoding
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 ofisTextSync
(a method which only lingers for backwards compatibility) -
isBinary
, which you should use instead ofisBinarySync
(a method which only lingers for backwards compatibility) -
getEncoding
, which you should use instead ofgetEncoding
(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 ofisText
's callback signature (a signature which only lingers for backwards compatibility) -
isBinaryCallback
, which you should use instead ofisBinary
's callback signature (a signature which only lingers for backwards compatibility) -
getEncodingCallback
, which you should use instead ofgetEncoding
'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 wrapsisText
with a promise signature -
isBinaryPromise
which wrapsisBinary
with a promise signature -
getEncodingPromise
which wrapsgetEncoding
with a promise signature
-
isBinary
method now correctly returnsnull
instead oftrue
when no inputs are provided✅ Added tests for all methods