cmpro-dat
v0.0.3
Published
ClrMamePro DAT parser for Node.js.
Downloads
3
Readme
cmpro-dat
A clrmamepro .dat format parser for Node.js.
Install
npm install cmpro-dat
Usage
DAT.parse
const DAT = require('cmpro-dat');
const text = `
clrmamepro (
name "Nintendo - Super Nintendo Entertainment System"
description "Nintendo - Super Nintendo Entertainment System"
)
game (
comment "Chrono Trigger (Japan)"
origin "Japan"
rom ( crc 4D014C20 )
)
game (
comment "Ultimate Mortal Kombat 3 (Europe)"
origin "US"
rom ( crc 1C4C54D2 )
)
`;
DAT.parse(text).then(data => {
console.log(data);
});
// [
// {
// __type: 'clrmamepro',
// name: 'Nintendo - Super Nintendo Entertainment System',
// description: 'Nintendo - Super Nintendo Entertainment System'
// },
// {
// __type: 'game',
// comment: 'Chrono Trigger (Japan)',
// origin: 'Japan',
// rom: { crc: '4D014C20' }
// },
// {
// __type: 'game',
// comment: 'Ultimate Mortal Kombat 3 (Europe)',
// origin: 'US',
// rom: { crc: '1C4C54D2' }
// }
// ]
DAT.stringify
const DAT = require('cmpro-dat');
const datString = DAT.stringify([
{
__type: 'clrmamepro',
name: 'Nintendo - Super Nintendo Entertainment System',
description: 'Nintendo - Super Nintendo Entertainment System',
},
{
__type: 'game',
comment: 'Chrono Trigger (Japan)',
origin: 'Japan',
rom: { crc: '4D014C20' },
},
{
__type: 'game',
comment: 'Ultimate Mortal Kombat 3 (Europe)',
origin: 'US',
rom: { crc: '1C4C54D2' },
},
]);
// clrmamepro (
// name "Nintendo - Super Nintendo Entertainment System"
// description "Nintendo - Super Nintendo Entertainment System"
// )
//
// game (
// comment "Chrono Trigger (Japan)"
// origin Japan
// rom (
// crc "4D014C20"
// )
// )
//
// game (
// comment "Ultimate Mortal Kombat 3 (Europe)"
// origin US
// rom (
// crc "1C4C54D2"
// )
// )