1.1.0 • Published 5 years ago
byte-converter-react v1.1.0
byte-converter-react ·

A small React component to convert between data sizes.
usage
$ npm install byte-converter-reactAvailable props:
children, is required and must be a positive, finite, integer, string or number.hideWarnings, boolean to turn on/off warnings.falseby default.suffix, boolean to turn on/off suffix. AKA unit written after the converted number.falseby default.inUnit, one of "b" (bit), "B" (byte), "KB" (kilobyte), "MB" (megabyte), "GB" (gigabyte), "TB" (terabyte), "PB" (petabyte).Bfor bytes by default.outUnit, one of "b", "B", "KB", "MB", "GB", "TB", "PB".MBfor megabytes by default.addCommas, will convert to locale string, 1,000,000 etc.falseby default.useSI, will use decimal notation instead of binary,falseby default.
Usage:
import React from "react";
import ByteConverter from "byte-converter-react";
class App extends React.Component {
render() {
return (
<ByteConverter suffix inUnit="KB" outUnit="MB">
1024
</ByteConverter>
);
}
}
export default App;