{"id":18039645,"url":"https://github.com/timbokz/fs-thumbnail","last_synced_at":"2025-03-27T10:32:20.374Z","repository":{"id":33615460,"uuid":"159984399","full_name":"TimboKZ/fs-thumbnail","owner":"TimboKZ","description":"Node.js library that generates thumbnails for files.","archived":false,"fork":false,"pushed_at":"2022-12-30T17:45:10.000Z","size":269,"stargazers_count":2,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-23T15:51:32.663Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/fs-thumbnail","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TimboKZ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-01T20:28:03.000Z","updated_at":"2022-09-06T16:21:38.000Z","dependencies_parsed_at":"2023-01-15T01:40:07.238Z","dependency_job_id":null,"html_url":"https://github.com/TimboKZ/fs-thumbnail","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimboKZ%2Ffs-thumbnail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimboKZ%2Ffs-thumbnail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimboKZ%2Ffs-thumbnail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimboKZ%2Ffs-thumbnail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TimboKZ","download_url":"https://codeload.github.com/TimboKZ/fs-thumbnail/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245827145,"owners_count":20678929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-30T14:09:57.365Z","updated_at":"2025-03-27T10:32:20.032Z","avatar_url":"https://github.com/TimboKZ.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fs-thumbnail\n\nNode.js library that generates thumbnails for files in the file system.\n\n# Overview\n\n`fs-thumbnail` was designed for [Ogma](https://github.com/TimboKZ/Ogma). It generates thumbnails based on file system\npaths of files. It tries several different libraries and uses the best match to generate the thumbnail. Libraries used\nfor thumbnail generation are listed below. The ones labelled with *peer dependency* must be installed separately, either\n using npm or your OS-specific package manager.\n* **[sharp](https://github.com/lovell/sharp)** (peer dependency: npm). Used for JPEG, PNG, WebP, TIFF, GIF and SVG\nimages.\n* **[ffmpeg](https://ffmpeg.org/)** (peer dependency: OS-specific). Used to generate video thumbnails.\n\n\u003e If you want to request support for a specific file type, please\n\u003e [create an issue](https://github.com/TimboKZ/fs-thumbnail/issues).\n\n# Installing\n\nInstall the main package:\n```bash\nnpm install fs-thumbnail\n```\n\nInstall some subset of peer dependencies that is relevant to your project:\n```bash\n# On all machines\nnpm install sharp@0\n\n# Make `ffmpeg` command available in your PATH.\n# E.g. on Debian and Ubuntu you can run:\napt install ffmpeg\n```\n\nNow you can use the library:\n```js\nconst ThumbnailGenerator = require('fs-thumbnail');\nconst thumbGen = new ThumbnailGenerator({\n    verbose: true, // Whether to print out warning/errors\n    size: [500, 300], // Default size, either a single number of an array of two numbers - [width, height].\n    quality: 70, // Default quality, between 1 and 100\n});\n\nthumbGen.getThumbnail({\n    path: '/path/to/my/image.png',\n    output: '/thumbnail/folder/thumbnail.jpg',\n    size: 300, // You can override the default size per thumbnail\n    quality: 70, // You can override the default quality per thumbnail\n})\n    .then(thumbnailPath =\u003e {\n        if (!thumbnailPath) console.log('Could not generate the thumbnail!');\n        else console.log(`Thumbnail generated! Find it here: ${thumbnailPath}`);\n    });\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimbokz%2Ffs-thumbnail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimbokz%2Ffs-thumbnail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimbokz%2Ffs-thumbnail/lists"}