The Data Storage Unit Conversion API allows you to convert a number and data storage unit to the most convenient unit.
https://converter.cyclic.app
https://converter.merkb.repl.co
The API accepts the following query parameters:
Parameter | Type | Required | Default Value | Description |
---|---|---|---|---|
data | number | Yes | N/A | The number to be converted. |
unit | string | No | bytes | The data storage unit (bytes, kilobytes, etc.). |
Example GET request:
GET https://converter.cyclic.app/?data=2345.678&unit=kilobytes
The API will respond with a JSON object containing the converted value.
Example response:
{
"result": "2.345678 megabytes"
}
You can use tools like cURL or javascript to make a GET request to the API.
curl "https://converter.cyclic.app/?data=2345.678&unit=kilobytes"
const data = 2345.678;
const unit = 'kilobytes';
// Construct the API URL with query parameters
const apiUrl = `https://converter.cyclic.app/?data=${data}&unit=${unit}`;
// Make the GET request to the API
fetch(apiUrl)
.then(response => response.json())
.then(data => {
const result = data.result;
console.log(result); // Output: 2.345678 megabytes
})
.catch(error => {
console.error('Error:', error);
});
const data = 2345.678;
const unit = 'kilobytes';
$.getJSON('https://converter.cyclic.app?data=' + data + '&unit=' + unit+ '',
function (data) {
console.log(data.contents);
});
});