{"id":48473682,"url":"https://github.com/contentstack/datasync-filesystem-sdk","last_synced_at":"2026-04-07T07:48:27.693Z","repository":{"id":40257984,"uuid":"167966010","full_name":"contentstack/datasync-filesystem-sdk","owner":"contentstack","description":"filesystem sdk for contentstack DataSync utility","archived":false,"fork":false,"pushed_at":"2026-04-07T05:50:27.000Z","size":1848,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":16,"default_branch":"master","last_synced_at":"2026-04-07T07:48:25.351Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/contentstack.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":"CODEOWNERS","security":"SECURITY.md","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":"2019-01-28T13:22:20.000Z","updated_at":"2026-04-07T05:48:12.000Z","dependencies_parsed_at":"2024-10-19T05:45:13.706Z","dependency_job_id":"443264ba-56ad-4c2f-a57a-69a97744db2c","html_url":"https://github.com/contentstack/datasync-filesystem-sdk","commit_stats":null,"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"purl":"pkg:github/contentstack/datasync-filesystem-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentstack%2Fdatasync-filesystem-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentstack%2Fdatasync-filesystem-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentstack%2Fdatasync-filesystem-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentstack%2Fdatasync-filesystem-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/contentstack","download_url":"https://codeload.github.com/contentstack/datasync-filesystem-sdk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentstack%2Fdatasync-filesystem-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31504897,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":[],"created_at":"2026-04-07T07:48:27.019Z","updated_at":"2026-04-07T07:48:27.654Z","avatar_url":"https://github.com/contentstack.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Contentstack](https://www.contentstack.com/docs/static/images/contentstack.png)](https://www.contentstack.com/)\n\nContentstack is a headless CMS with an API-first approach. It is a CMS that developers can use to build powerful cross-platform applications in their favorite languages. Build your application frontend, and Contentstack will take care of the rest. [Read More](https://www.contentstack.com/).\n\n## Contentstack DataSync Filesystem SDK\n\n[Contentstack DataSync](https://www.contentstack.com/docs/guide/synchronization/contentstack-datasync) provides Filesystem SDK to query applications that have locally stored contents in filesystem. Given below is the detailed guide and helpful resources to get started with Filesystem SDK.\n\n### Prerequisite\n\n- Nodejs, v20 or higher\n- You should have the data synced through [Contentstack DataSync](https://www.contentstack.com/docs/guide/synchronization/contentstack-datasync)\n\n### Configuration\n\n|Property|Type|Defaults|Description|\n|--|--|--|--|\n|baseDir|string|./_contents|**Optional** Base directory of the folder where data is stored.|\n|locale|string|'en-us'|**Optional** Default locale that'd be considered, if the .language() isn't specified in queries|\n|referenceDepth|number|2|**Optional** The default nested-reference-field depth that'd be considered when calling .includeReferences(). This can be overridden by passing a numerical argument to .includeReferences(4)|\n|projections|object|{_content_type_uid: 0}|**Optional** Keys that by default would be removed from results. Pass `key: 0` to remove, `key: 1` to override the existing..|\n\n### Environment Variables\n\nThe SDK supports the following environment variables for advanced configuration:\n\n| Variable    | Description | Default |\n|-------------|-------------|-------------| \n| `APP_ROOT`  | (Optional) Sets the root directory for content storage. | current working directory |\n\n### Config Overview\n\nHere's an overview of the SDK's configurable properties\n\n```ts\n{\n  contentStore: {\n    baseDir: './_contents',\n    defaultSortingField: 'updated_at',\n    locale: 'en-us',\n    projections: {\n      _content_type_uid: 0,\n    },\n    referenceDepth: 2,\n  },\n}\n```\n\n### Sample SDK Query\n\nHere's a sample SDK query to get started. Learn more on how to query using datasync-filesystem-sdk [here](https://contentstack.github.io/datasync-filesystem-sdk/).\n\n```ts\nimport { Contentstack } from 'datasync-filesystem-sdk'\nconst Stack = Contentstack.Stack(config)\n\nStack.connect()\n  .then(() =\u003e {\n    return Stack.contentType('blog')\n      .entries()\n      .language('en-gb') // Optional. If not provided, defaults to en-us\n      .include(['authors'])\n      .includeCount()\n      .includeContentType()\n      .queryReferences({'authors.firstName': 'R.R. Martin'})\n      .then((result) =\u003e {\n        // Your result would be\n        // {\n        //   entries: [...], // All entries, who's first name is R.R. Martin\n        //   content_type_uid: 'blog',\n        //   locale: 'es-es',\n        //   content_type: {...}, // Blog content type's schema\n        //   count: 3, // Total count of blog content type\n        // }\n      })\n  })\n  .catch((error) =\u003e {\n    // handle errors..\n  })\n```\n\u003e Important: You need to call .connect(), to initiate SDK queries!\n\nOnce you have initialized the SDK, you can start querying on the filesystem\n\n### Querying\n- Notes\n  - By default, 'content_type_uid' and 'locale' keys as part of the response.\n  - If `.language()` is not provided, then the 1st language, provided in `config.defaultLocale` would be considered.\n  - If querying for a single entry/asset (using `.entry()` OR `.findOne()`), the result will be an object i.e. `{ entry: {} }`, if the entry or asset is not found, `{ entry: null }` will be returned.\n  - Querying multiple entries, would return `{ entries: [ {...} ] }`.\n  - By default, all entry responses would include their referred assets. If `.excludeReferences()` is called, no references (including assets) would **not** be returned in the response.\n\n- Query a single entry\n```ts\n// Sample 1. Returns the 1st entry that matches query filters\nStack.contentType('blog')\n  .entry() // OR .asset()\n  .find()\n  .then((result) =\u003e {\n    // Response\n    // result = {\n    //   entry: any | null,\n    //   content_type_uid: string,\n    //   locale: string,\n    // }\n  })\n  .catch(reject)\n\n// Sample 2. Returns the 1st entry that matches query filters\nStack.contentType('blogs')\n  .entries() // for .assets() \n  .findOne()\n  .then((result) =\u003e {\n    // Response\n    // result = {\n    //   entry: any | null,\n    //   content_type_uid: string,\n    //   locale: string,\n    // }\n  })\n  .catch(reject)\n```\n\n- Querying a set of entries, assets or content types\n```ts\nStack.contentType('blog')\n  .entries() // for .assets() \n  .includeCount()\n  .find()\n  .then((result) =\u003e {\n    // Response\n    // result = {\n    //   entry: any | null,\n    //   content_type_uid: string,\n    //   count: number,\n    //   locale: string,\n    // }\n  })\n  .catch(reject)\n```\n\n## Advanced Queries\n\nIn order to learn more about advance queries please refer the API documentation, [here](https://contentstack.github.io/datasync-filesystem-sdk/).\n  \n## Further Reading\n- [Getting started with Contentstack DataSync](https://www.contentstack.com/docs/developers/develop-apps-with-datasync/get-started-with-contentstack-datasync) \n- [Contentstack DataSync](https://www.contentstack.com/docs/developers/develop-apps-with-datasync/configuration-files-for-contentstack-datasync) doc lists the configuration for different modules\n\n## Support and Feature requests\n\nIf you have any issues working with the library, please file an issue [here](https://github.com/contentstack/datasync-filesystem-sdk/issues) at Github.\n\nYou can send us an e-mail at [support@contentstack.com](mailto:support@contentstack.com) if you have any support or feature requests.\n\nOur support team is available 24/7 on the intercom. You can always get in touch and give us an opportunity to serve you better!\n\n## License\n\nThis repository is published under the [MIT license](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontentstack%2Fdatasync-filesystem-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcontentstack%2Fdatasync-filesystem-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontentstack%2Fdatasync-filesystem-sdk/lists"}