Deno module to convert fiat currencies with fetched API from fixer.io

Overview

Usage example

Deno module to convert fiat money currencies with initial fetched API from fixer.io There are two different modes for this module.

Mode 1) Convert Currency with Realtime Data from fixer.io (API-Key required: https://fixer.io/)

import {FiatConverter_fromAPI} from 'https://deno.land/x/[email protected]/api_mod.ts'
const api_key = "12ed855902ddbea5df116639e8e3a1b2"
var amount = 100
var input_currency = "EUR"
var output_currency = "USD"

let FiatConverter = new FiatConverter_fromAPI()
var result = await FiatConverter.convert(api_key, amount, input_currency, output_currency)
console.log('Result:', result, output_currency)

Test via commandline (provided API-KEY)

deno run --allow-net "https://deno.land/x/[email protected]/test_api.ts"

Output

Result: 113.25 "USD"

Fixer.io offers 100 free API request calls per month! Create your fixer.io API_Key now and calculate currencies in Realtime for free with this deno module!
Link: https://fixer.io/

Mode 2) Convert Currency with copied data from data.json file

// Copy the JSON file into current directory, this file will be used for the currency conversion
import json from 'https://deno.land/x/[email protected]/data.json' assert { type: 'json' };
const write = Deno.writeTextFile("./data.json", JSON.stringify(json))
write.then(() => console.log("File written to ./data.json"));

import {FiatConverter_fromJSON} from 'https://deno.land/x/[email protected]/json_mod.ts'
var amount = 100
var input_currency = "EUR"
var output_currency = "USD"

let FiatConverter = new FiatConverter_fromJSON()
var result = await FiatConverter.convert(amount, input_currency, output_currency)
console.log("Result ", result, output_currency)

Test via commandline (provided API-KEY)

deno run --allow-net --allow-write --allow-read "https://deno.land/x/[email protected]/test_json.ts"

Output

Result: 112.38 "USD"

Thank you for the helpful modules that were used in this module!

https://deno.land/x/[email protected]

https://deno.land/x/[email protected]

You might also like...

deno-ja (Deno Japanese community) showcase

Showcase Deno本家よりも気軽に作ったものを公開できるようなShowcaseです。 スクリーンショットの撮影方法 短めのidを決めていただいて、下記のようにスクリプトを実行してください。 deno task screenshot [url] [id] ※エラーが出る場合は、下記を実行してみ

Oct 28, 2022

A command-line tool to manage Deno scripts installed via deno install

🏞️ nublar nublar is a command-line tool to manage your scripts installed via deno install. 🛳️ Installation deno install --allow-read --allow-write -

Dec 26, 2022

Deno module to generate images from source code using Aloxaf/silicon.

Deno module to generate images from source code using Aloxaf/silicon.

deno-silicon Deno module to generate images from source code using Aloxaf/silicon. Dependencies Please refer silicon's dependencies Support Version de

Dec 13, 2022

Unofficial Deno Module for Nekos.best

Nekos-Best-Deno Unofficial Deno module for nekos.best. If you're using Nodejs please use the official javascript wrapper. Usage Import the module in y

Jan 4, 2023

Fintoc.js ES Module - Use the Fintoc widget as an ES module

Fintoc.js ES Module Use the Fintoc widget as an ES module. Installation Install using npm! (or your favourite package manager) # Using npm npm install

May 13, 2022

Template Repository for making your own budder Module. CORE is not included, this is just for the module.

A quick copy of the "How to make your own module" section Check out the official budderAPI repository Template Repository for making your own budder M

Apr 3, 2022

Userland module that implements the module path mapping that Node.js does with "exports" in package.json

exports-map Userland module that implements the module path mapping that Node.js does with "exports" in package.json npm install exports-map Usage co

May 31, 2022

A module federation SDK which is unrelated to tool chain for module consumer.

A module federation SDK which is unrelated to tool chain for module consumer.

hel-micro, 模块联邦sdk化,免构建、热更新、工具链无关的微模块方案 Demo hel-loadash codesandbox hel-loadash git Why hel-micro 如何使用远程模块 仅需要一句npm命令即可载入远程模块,查看下面例子线上示例 1 安装hel-micr

Jan 3, 2023
Comments
  • Deno Module Still Buggy

    Deno Module Still Buggy

    error: Uncaught (in promise) NotFound: Das System kann die angegebene Datei nicht finden. (os error 2), open './data.json' return JSON.parse(await Deno.readTextFile(filePath))

    at async open (deno:runtime/js/40_files.js:51:17)
    at async readFile (deno:runtime/js/40_read_file.js:25:18)
    at async Object.readTextFile (deno:runtime/js/40_read_file.js:43:24)
    at async loadJsonFile (https://deno.land/x/[email protected]/mod.ts:22:20)
    at async FiatConverter_fromJSON.get_data (https://deno.land/x/[email protected]/src/convert_fromJSON.ts:7:21)
    
    opened by mimed100 0
Releases(v1.1.0)
Owner
Michel M.
Michel M.
Opinionated collection of TypeScript definitions and utilities for Deno and Deno Deploy. With complete types for Deno/NPM/TS config files, constructed from official JSON schemas.

Schemas Note: You can also import any type from the default module, ./mod.ts deno.json import { type DenoJson } from "https://deno.land/x/[email protected]

deno911 2 Oct 12, 2022
This is a dependency-free easy-to-use vanilla JavaScript addon allowing you to create HTML currency inputs with various different currencies and formattings.

intl-currency-input This is a dependency-free easy-to-use vanilla JavaScript addon allowing you to create HTML currency inputs with various different

null 6 Jan 4, 2023
An npm package for demonstration purposes using TypeScript to build for both the ECMAScript Module format (i.e. ESM or ES Module) and CommonJS Module format. It can be used in Node.js and browser applications.

An npm package for demonstration purposes using TypeScript to build for both the ECMAScript Module format (i.e. ESM or ES Module) and CommonJS Module format. It can be used in Node.js and browser applications.

Snyk Labs 57 Dec 28, 2022
TypeSafe MongoDB Atlas Data API SDK for Deno & Deno Deploy

Atlas SDK atlas_sdk is a TypeSafe MongoDB Atlas Data API SDK for Deno & Deno Deploy Links Docs Import Replace LATEST_VERSION with current latest versi

Erfan Safari 20 Dec 26, 2022
Minimal utility to convert to or from any timezone. Deno/Node/Browser. ESM/CommonJS.

minitz Features Convert dates between any timezone supported by the system. Parses ISO8601 time strings. MIT licensed, use the library any way you wan

Hexagon 14 Oct 10, 2022
Module to convert units for distances, weights and temperatures!

Unit Converter (Distance, Temperature, Weights) Every unit you can see in this file can be transformed into any of the other units. The Calculator wor

Niklas Koch 8 Jan 27, 2022
This is a simple boilerplate for a Deno website, deployed with Deno Deploy.

Simple Deno Website Boilerplate This is a simple website boilerplate built using Deno and deployed using Deno Deploy. Demo at simple-deno-website-boil

Bruno Bernardino 15 Dec 3, 2022
Deno bindings for yoga, using Deno FFI.

deno_yoga Deno bindings for yoga, using Deno FFI. Usage flags: --allow-ffi: Requires ffi access to "yogacore.dll", "libyogacore.so", "libyogacore.dyli

迷渡 6 Feb 11, 2022
🛣️ A tiny and fast http request router designed for use with deno and deno deploy

Rutt Rutt is a tiny http router designed for use with deno and deno deploy. It is written in about 200 lines of code and is pretty fast, using an exte

Denosaurs 26 Dec 10, 2022
A small, but powerful HTTP library for Deno & Deno Deploy, built for convenience and simplicity

Wren Wren is a small, but powerful HTTP library for Deno & Deno Deploy, built for convenience and simplicity. convenient aliases for HTTP responses au

Jakub Neander 69 Dec 12, 2022