
Product
Reachability for Ruby Now in Beta
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.
@arctics/utils
Advanced tools
A JavaScript/TypeScript package providing utilities around certain functionalities
A JavaScript/TypeScript package providing utilities around certain functionalities.
npm install @arctics/utils
or
yarn add @arctics/utils
import { FileConverter } from '@arctics/utils';
// Create an instance of FileConverter
const fileConverter = new FileConverter();
// Convert a file to base64
fileConverter.fileToBase64('path/to/file.txt').then((base64String) => {
console.log('Base64:', base64String);
});
// Convert a URL to base64
fileConverter
.fileToBase64('https://example.com/image.png')
.then((base64String) => {
console.log('Base64:', base64String);
});
// Convert a base64 string to a file
fileConverter.base64ToFile('base64String', 'path/to/output.txt').then(() => {
console.log('File written successfully');
});
// Convert a file to hexadecimal
fileConverter.fileToHex('path/to/file.txt').then((hexString) => {
console.log('Hexadecimal:', hexString);
});
// Convert a hexadecimal string to a file
fileConverter.hexToFile('hexString', 'path/to/output.txt').then(() => {
console.log('File written successfully');
});
import { Localization } from '@arctics/utils';
// Set the locale to French (France)
Localization.setLocale('fr-FR');
// Get the current locale
console.log(Localization.getLocale()); // Output: 'fr-FR'
// Format a number according to the current locale
console.log(Localization.formatNumber(1234567.89)); // Output: '1 234 567,89'
// Format a number as currency according to the current locale
console.log(Localization.formatCurrency(1234567.89, 'EUR')); // Output: '1 234 567,89 €'
// Format a date according to the current locale
console.log(Localization.formatDate(new Date())); // Output: '19 févr. 2025'
// Format a phone number according to the current locale
console.log(Localization.formatPhoneNumber('+33612345678')); // Output: '06 12 34 56 78' (example for France)
fileToBase64(source: string | Buffer | ReadableStream): Promise<string | null>
Converts a file, URL, Buffer, or ReadableStream to a base64 string.
source: The source to convert. Can be a file path (string), URL (string), Buffer, or ReadableStream.base64ToFile(base64String: string, outputPath: string): Promise
Writes a base64 string to a file.
base64String: The base64 string to write.outputPath: The path to the output file.fileToHex(filePath: string): Promise<string | null>
Converts a file to a hexadecimal string.
filePath: The path to the file.hexToFile(hexString: string, outputPath: string): Promise
Writes a hexadecimal string to a file.
hexString: The hexadecimal string to write.outputPath: The path to the output file.isURL(str: string): boolean
Checks if a string is a valid URL.
str: The string to check.convertFromFile(filePath: string): Promise<string | null>
Converts a file to a base64 string.
filePath: The path to the file.convertFromURL(url: string): Promise<string | null>
Converts a URL to a base64 string.
url: The URL.convertFromBuffer(buffer: Buffer): string
Converts a Buffer to a base64 string.
buffer: The Buffer.convertFromStream(stream: ReadableStream): Promise<string | null>
Converts a ReadableStream to a base64 string.
stream: The ReadableStream.setLocale(localeCode: string): void
Sets the current locale to the provided locale code.
getLocale(): string
Returns the current locale code.
formatNumber(number: number): string
Formats a number according to the current locale.
formatCurrency(number: number, currencyCode: string = 'USD'): string
Formats a number as currency according to the current locale.
formatDate(date: Date | string, options?: Intl.DateTimeFormatOptions): string
Formats a date according to the current locale.
formatPhoneNumber(phoneNumber: string): string
Formats a phone number according to the specified region or the current locale.
For a detailed list of supported locales, please refer to the Locales List file.
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License.
FAQs
A JavaScript/TypeScript package providing utilities around certain functionalities
We found that @arctics/utils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.

Research
/Security News
Malicious npm packages use Adspect cloaking and fake CAPTCHAs to fingerprint visitors and redirect victims to crypto-themed scam sites.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.