csv-to-apkg
/
1.1.4
csv-to-apkg 1.1.4
Install from the command line:
Learn more about npm packages
$ npm install @2anki/csv-to-apkg@1.1.4
Install via package.json:
"@2anki/csv-to-apkg": "1.1.4"
About this version
A small library to convert CSV files to APKG files.
This project is part of 2anki.net and uses the following dependencies:
Make sure these projects are available one level above this project:
git clone https://github.com/2anki/2anki.net ../server
git clone https://github.com/2anki/create_deck ../create_deck
npm i @2anki/csv-to-apkg
Below is an example showing you how to convert your csv (string).
import convertCSVToAPKG from '@2anki/csv-to-apkg';
const csvContent = `Front,Back
What is the capital of Germany?,Berlin`;
convertCSVToAPKG(csvContent); // Promise<Buffer>
import fs from 'fs';
import os from 'os';
import resolvePath from '../filesystem/resolvePath';
import Workspace from '../filesystem/Workspace';
import APKGExporter from '../filesystem/APKGExporter';
import convertCSVToAPKG from '../convertCSVToAPKG';
const workspace = new Workspace(os.tmpdir());
const exporter = new APKGExporter('Default', workspace.location);
const csvFile = fs
.readFileSync(
resolvePath(
__dirname,
'../mocks/Japanese Words 71594f63607d440fa080879385ec0acc.csv'
),
'utf-8'
)
.toString();
/* eslint-disable no-console */
console.log('workspace.location', workspace.location);
convertCSVToAPKG(csvFile, exporter)
.then(() => {
console.log('Files available at: ', workspace.location);
console.info('Done!');
})
.catch(console.error);
csv-to-apkg
reads your comma delimited data. It takes the first column and treats it as the front of the card. The remaining columns are the back of the card.
Cloze deletion are not supported.
Unless otherwise specified in the source:
The code is licensed under the MIT Copyright (c) 2023, Alexander Alemayhu.
Details
- csv-to-apkg
- 2anki
- about 1 year ago
- MIT
- 12 dependencies
Assets
- csv-to-apkg-1.1.4.tgz
Download activity
- Total downloads 0
- Last 30 days 0
- Last week 0
- Today 0