# i64

> URL safe Base64 Integer Strings (BIS) and conversion tools. Supports both fast conversions for regular integers and large integer strings. Assists with compression as fewer base 64 digits are needed to represent larger integers than base 10 digits. Unlike RFC-3548 Base 64 encodings, readability of BIS is improved for small integers by using an alphabet that extends base-converter

Latest version **0.5.8** (published 2013-09-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install i64
pnpm add i64
yarn add i64
bun add i64
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.8 |
| Published | 2013-09-12 |
| First published | 2013-08-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.8.0 |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | angleman |
| Maintainers | angleman |
| Keywords | url, base64, hex, hexidecimal, integer, date, time, timestamp, geo, degrees, longitude, latitude, compression, tools, conversion |

## Links

- npm: https://www.npmjs.com/package/i64
- Repository: https://github.com/angleman/i64
- Issues: https://github.com/angleman/i64/issues
- npm.io page: https://npm.io/package/i64

## Dependencies (3)

- [microtime](https://npm.io/package/microtime.md) ~0.3.3
- [validator](https://npm.io/package/validator.md) ~1.5.0
- [int-encoder](https://npm.io/package/int-encoder.md) ~0.1.4

## Alternatives

- [@js-joda/timezone](https://npm.io/package/@js-joda/timezone.md) — 383.4K weekly downloads
- [chartjs-adapter-moment](https://npm.io/package/chartjs-adapter-moment.md) — 210.8K weekly downloads
- [strftime](https://npm.io/package/strftime.md) — 171.2K weekly downloads
- [vue-flatpickr-component](https://npm.io/package/vue-flatpickr-component.md) — 115.8K weekly downloads
- [timepicker](https://npm.io/package/timepicker.md) — 51.0K weekly downloads

## Recent versions

- 0.5.8 (latest) — 2013-09-12
- 0.5.3 — 2013-09-10
- 0.5.2 — 2013-08-31
- 0.4.5 — 2013-08-31
- 0.4.4 — 2013-08-30
- 0.4.2 — 2013-08-30
- 0.4.1 — 2013-08-30
- 0.4.0 — 2013-08-30
- 0.3.4 — 2013-08-30
- 0.3.3 — 2013-08-30
- 0.3.0 — 2013-08-30
- 0.2.3 — 2013-08-30
- 0.2.2 — 2013-08-30
- 0.2.1 — 2013-08-30
- 0.2.0 — 2013-08-30

## README

# i64 [![NPM version](https://badge.fury.io/js/i64.png?branch=master)](https://npmjs.org/package/i64) [![Build Status](https://travis-ci.org/angleman/i64.png?branch=master)](https://travis-ci.org/angleman/i64) [![Dependency Status](https://gemnasium.com/angleman/i64.png?branch=master)](https://gemnasium.com/angleman/i64) [![License](http://badgr.co/use/MIT.png?bg=%234ed50e)](#licensemit)

URL safe Base64 Integer Strings (BIS) and conversion tools. Supports both fast conversions for regular integers and large integer strings (via [alan/clarke/int-encoder](http://github.com/alanclarke/int-encoder)). Assists with compression as fewer base 64 digits are needed to represent larger integers than base 10 digits. Unlike RFC-3548 Base 64 encodings, readability of BIS is improved for small integers by using an alphabet that extends base-converter in PHP and following node [base-converter](https://github.com/naholyr/node-base-converter).


## Install

```
npm install i64
```

## Usage

```
var i64 = require('i64');       // initial instance

i64.config([config])            // get/set configuration

i64.date([date])                // get/set value as Date
i64.degree([degrees])           // get/set value as Geo Degrees (+/- 180.0)
i64.geo([geo])                  // get/set value as Geo Point as {longitude: value, latitude: value}
i64.geoSet([geoset])            // get/set value as Geo Point as [longitude, latitude]
i64.hex([hex_string])           // get/set value as Hexidecimal
i64.int([integer])              // get/set value as Integer
i64.microtime([microtime])      // get/set value as Microtime (wadey/node-microtime)

i64.isBis(BIS)                  // true if a valid Base64 Integer String (BIS)

i64.valueOf([int64_string])     // value as BIS, set option

i64.new(config)                 // new instance factory
```

## Examples

```
i64.nt(64).valueOf()                 // _         integer to BIS

i64.valueOf('a').asInt()             // 10        BIS to integer 

i64.hex('ff').asInt()                // 255       hexidecimal to integer

date = new Date(2013,08,29,20,12,15,0)
i64.date(date).valueOf()              // 38tkcf00  date to BIS 

i64.degree(-71.5653).valueOf()        // ji        ~10km accuracy with default 2 digit precision

point = {latitude: 43.4108, longitude:-71.5653}
i64.geo(point).valueOf()              // DKji     

point = [43.4108, -71.5653]
i64.geoSet(point).valueOf()           // DKji     
```

## Default Config

```
{ 
   base_year:      2010,
   alphabet:       '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_',
   geo_precision": 2  // Values 1: ~400 miles, 2: ~6 miles, 3: ~500 feet, 4: ~10 feet, 5: ~10 inches
}
```

## License: MIT

Dependencies: 

[![int-encoder](http://badgr.co/int-encoder/MIT.png?bg=%23339e00 "int-encoder@0.1.4 Massachusetts Institute of Technology")](https://github.com/alanclarke/int-encoder)

[![validator](http://badgr.co/validator/MIT.png?bg=%23339e00 "validator@1.5.1 Massachusetts Institute of Technology")](http://github.com/chriso/node-validator)
[![microtime](http://badgr.co/microtime/MIT*.png?bg=%23339e00 "microtime@0.3.3 Massachusetts Institute of Technology (it seems based on text scan)")](https://github.com/wadey/node-microtime)

---
_Source: https://npm.io/package/i64 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
