{"id":20423595,"url":"https://github.com/alessiovelluso/wordfileutils","last_synced_at":"2026-02-28T22:02:22.447Z","repository":{"id":243508280,"uuid":"812612912","full_name":"alessioVelluso/WordFileUtils","owner":"alessioVelluso","description":"Word finder and translation/csv utils","archived":false,"fork":false,"pushed_at":"2026-02-12T11:12:06.000Z","size":283,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-12T19:22:23.556Z","etag":null,"topics":["csv","csv-parser","text","translation","word"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/word-file-utils?activeTab=readme","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alessioVelluso.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-06-09T11:46:24.000Z","updated_at":"2026-02-12T11:12:09.000Z","dependencies_parsed_at":"2024-06-09T13:47:51.576Z","dependency_job_id":"87a61e9d-80d2-45e7-90fb-25c0a580eb54","html_url":"https://github.com/alessioVelluso/WordFileUtils","commit_stats":null,"previous_names":["alessiovelluso/wordfileutils"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/alessioVelluso/WordFileUtils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessioVelluso%2FWordFileUtils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessioVelluso%2FWordFileUtils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessioVelluso%2FWordFileUtils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessioVelluso%2FWordFileUtils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alessioVelluso","download_url":"https://codeload.github.com/alessioVelluso/WordFileUtils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessioVelluso%2FWordFileUtils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29953212,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T18:42:55.706Z","status":"ssl_error","status_checked_at":"2026-02-28T18:42:48.811Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csv","csv-parser","text","translation","word"],"created_at":"2024-11-15T07:07:02.706Z","updated_at":"2026-02-28T22:02:17.437Z","avatar_url":"https://github.com/alessioVelluso.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# Word File Utils\n\n`v2.0.3`\nThis is a package i made for myself but can surely be helpful to others, feel free to contribute if you like it.\n\n\u003e [!WARNING]\n\u003e If you need excel js install [fast-js-excel](https://github.com/alessioVelluso/FastExcel) or take a look at [utils-stuff](https://github.com/alessioVelluso/UtilsStuff) wich is the lighter package.\n\u003e **DO NOT INSTALL ALL THREE LIBS CAUSE ONE IS THE \"PARENT\" OF THE OTHER:**\n\u003e 1. `utils-stuff`\n\u003e 2. `word-file-utils` (including utils-stuff)\n\u003e 3. `fast-js-excel` (including exceljs, word-file-utils (including utils-stuff))\n\u003e\n\u003eSo if you install word-file utils you can use the classes of utils-stuff and so on, choose the one for your pourpose.\n\n## Install:\n```bash\nnpm install word-file-utils\n```\nThe `WordFileUtils` extends a simple class with a simple function using the [statickidz/node-google-translate-skidz](https://github.com/statickidz/node-google-translate-skidz) api.\nWith this package comes the [alessiovelluso/utils-stuff](https://www.npmjs.com/package/utils-stuff), a package of server/client utilities that can be helpful, be sure to check the library for all the different utilities you can use. This one has basically two different classes `GenericUtils` \u0026 `ClientFilters`, you can import them just as explained from the lib documentation but using \"word-file-utils\" like\n```ts\nimport { GenericUtils } from \"word-file-utils\"\n```\n\n\n\nAt the moment, the interface of the class is as it follows:\n```ts\ninterface  IWordFileUtils {\n\tseparator:string;\n\terrorTranslationValue:string;\n\ttranslationColumnName:string;\n\n\n\tparseCsvToObjectList:\u003cT extends Record\u003cstring, string | number | boolean | Date\u003e = GenericObject\u003e(csvFilepath:string, separator?:string) =\u003e T[];\n\tparseObjectListToCsv:\u003cT extends  GenericObject = GenericObject\u003e(data:T[], separator?:string) =\u003e string\n\twriteCsv:\u003cT extends GenericObject = GenericObject\u003e(outputCsv:string, data:T[], separator?:string) =\u003e Promise\u003cvoid\u003e\n\n\ttranslateValue:(value:string, localeIn:string, localeOut:string) =\u003e Promise\u003cstring\u003e;\n\ttranslateObjectList:\u003cT extends GenericObject = GenericObject\u003e(data:T[], { translatingCol, cultureFrom, cultureTo }:TranslationConfig) =\u003e Promise\u003cT[]\u003e\n\ttranslateCsv:(data:TranslateCsvConfig) =\u003e Promise\u003cvoid\u003e;\n\n\n\tfindWords: (folderToRead:string, desiredExtensions:string[], excludeDir:string[], wordToFind:RegExp) =\u003e string[],\n\twriteJson:\u003cT extends GenericObject = GenericObject\u003e(outputCsv:string, data:T[]) =\u003e void\n}\n```\n\n\n## Initialize the class\n```ts\nimport { WordFileUtils } from \"word-file-utils\"\n```\nI raccomand you to initialize a new object every file that requires it.\nThe constructor of WordFileUtils follows this interface:\n```ts\nconstructor(data?:TranslationMakerConstructor)\ninterface TranslationMakerConstructor { separator?:string, errorTranslationValue?:string, translationColumnName?:string }\n```\nThe **separator** can be defined here or in any method that requires it as an optional parameter.\nThe **errorTranslationValue** and **translationColumnName** are specific to the translations method.\n\n\n## A brief explanation of the methods:\n##### 1. Parse Csv To Object List\n```js\nparseCsvToObjectList:\u003cT extends Record\u003cstring, string | number | boolean | Date\u003e = GenericObject\u003e(csvFilepath:string, separator?:string) =\u003e T[];\n```\nParse a csv in an array of object, having the key as column name:\n```\nCol1,Col2\nValue1,Value2\nValue3,Value4\n```\nThis is gonna be parsed as\n```ts\n[\n\t{ Col1:  Value1, Col2:Value2 },\n\t{ Col1:  Value3, Col2:Value4 },\n]\n```\n\n\n##### 2. Parse Object List To Csv\n```ts\nparseObjectListToCsv:\u003cT extends GenericObject = GenericObject\u003e(data:T[], separator:string) =\u003e string\n```\nReturns a string ready to be written down with the specific `writeCsv\u003cT = GenericObject\u003e(outputCsv:string, data:T, separator?:string)`or passed in an api\n\n\n\n##### 3. Write Csv\n```ts\nwriteCsv:\u003cT extends GenericObject = GenericObject\u003e(outputCsv:string, data:T[], separator?:string) =\u003e Promise\u003cvoid\u003e\n```\nWrite a csv locally with an object list parameter, having the column as the object keys.\nIt uses the related `parseObjectListToCsv` method\n\n\n##### 4. Translate Value\n```ts\ntranslateObjectList:\u003cT extends GenericObject = GenericObject\u003e(data:T[], { translatingCol, cultureFrom, cultureTo }:TranslationConfig) =\u003e Promise\u003cT[]\u003e\n```\nSimply translating a word to the desired one\n\n\n##### 5. Translate Object List\n```ts\ntranslateObjectList:(data:GenericObject[], { translatingCol, cultureFrom, cultureTo }:TranslationConfig) =\u003e Promise\u003cGenericObject[]\u003e\n```\nAfter specifying the target column, the func return the same object list with an added key of the translation\n\n\n##### 6. Translate Csv\n```ts\ntranslateCsv:(data:TranslateCsvConfig) =\u003e Promise\u003cvoid\u003e\n```\nTake a csv as input and write the same csv with an added translated_value column.\nIt uses the related `parseCsvToObjectList`, `translateObjectList` and `writeCsv` methods\n\n\n##### 7. Find Words\n```ts\nfindWords: (folderToRead:string, desiredExtensions:string[], wordToFind:RegExp) =\u003e string[]\n```\nThis will search along the whole project, in specified extensions files, and return a list of all the words matching a specified RegExp pattern.\n\n\n##### 8. Write Json\n```ts\nwriteJson:\u003cT extends GenericObject = GenericObject\u003e(outputCsv:string, data:T[]) =\u003e void\n```\nEasily write a local json\n\n\n\n## Types\n```ts\nimport { GoogleTranslateLocales } from  \"./translate.types\"\n\n\nexport  interface  TranslationConfig { translatingCol:string, cultureFrom:GoogleTranslateLocales, cultureTo:GoogleTranslateLocales }\n\nexport  interface  TranslateCsvConfig  extends  TranslationConfig { csvFilepath:string, outFilepath:string, separator?:string }\n\nexport  interface  TranslationMakerConstructor { separator?:string, errorTranslationValue?:string, translationColumnName?:string }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falessiovelluso%2Fwordfileutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falessiovelluso%2Fwordfileutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falessiovelluso%2Fwordfileutils/lists"}