Socket
Socket
Sign inDemoInstall

strings-file

Package Overview
Dependencies
2
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    strings-file

Node.js module for processing utf-16 ios/osx .strings files.


Version published
Weekly downloads
25K
decreased by-1.4%
Maintainers
1
Install size
375 kB
Created
Weekly downloads
 

Readme

Source

#node-strings-file

Node.js module for processing utf-16 ios/osx .strings files.

Installing with npm

$ npm install strings-file

Usage

readStrings(filename, callback, withComments)

// Require strings-file
var StringsFile = require('strings-file');

StringsFile.readStrings('Localizable.strings', function(err, data){
	console.log(data);
});

readStringsSync(filename, withComments)

var StringsFile = require('strings-file');

var data = StringsFile.readStringsSync('Localizable.strings', true);
console.log(data);

writeStrings(filename, data, callback)

var StringsFile = require('strings-file');

var data = {
	'key_0': 'value_0',
	'key_1': 'value_1'
};

StringsFile.writeStrings('Localizable.strings', data, function(err){
	if(!err){
		console.log('File written');
	}
});

writeStringsSync(filename, data)

var StringsFile = require('strings-file');

var data = {
	'key_0': {value:'value_0',comment:'comment_0'},
	'key_1': {value:'value_1',comment:'comment_1'}
};
StringsFile.writeStringsSync('Localizable.strings', data);

parse(input, withComments)

var StringsFile = require('strings-file');

// A string in the .strings file format
var input = '"key" = "value";'

var data = StringsFile.parse(input, false);

compile(data, [options])

var StringsFile = require('strings-file');

var data = {
	'key_0': 'value_0',
	'key_1': 'value_1'
};

var str = StringsFile.compile(data);

data = {
	'key_0': { 'value' : 'value_0', 'comment' : 'comment_0' },
	'key_1': { 'value' : 'value_1', 'comment' : 'comment_1' }
};

var str = StringsFile.compile(data);    

FAQs

Last updated on 21 Mar 2016

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc