{"_id":"@attorn/electron-storage","_rev":"7-485ec0dc90aa5eba8c9d793f71fe6694","name":"@attorn/electron-storage","dist-tags":{"latest":"2.1.1"},"versions":{"1.0.0":{"private":false,"name":"@attorn/electron-storage","version":"1.0.0","description":"#### The `@attorm/electron-storage` package The `@attorm/electron-storage` package is a really light, simple and convenient package that has been implemented for use in the `Attorn` project.  Because the `Attorn` project has a significant number of differ","main":"dist/index.js","repository":{"type":"git","url":"git+https://github.com/attorn/-attorn-react-explorer.git"},"author":{"name":"qafoori"},"license":"MIT","bugs":{"url":"https://github.com/attorn/-attorn-react-explorer/issues"},"homepage":"https://github.com/attorn/-attorn-react-explorer#readme","scripts":{"dev":"dumi dev","docs:build":"dumi build","docs:deploy":"gh-pages -d docs-dist","build":"father-build","deploy":"npm run docs:build && npm run docs:deploy","release":"npm run build && npm publish","prettier":"prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"","test":"umi-test","test:coverage":"umi-test --coverage"},"module":"dist/index.esm.js","typings":"dist/index.d.ts","gitHooks":{"pre-commit":"lint-staged"},"lint-staged":{"*.{js,jsx,less,md,json}":["prettier --write"],"*.ts?(x)":["prettier --parser=typescript --write"]},"dependencies":{"electron":"^15.3.0","fs":"^0.0.1-security","path":"^0.12.7","react":"^16.12.0 || ^17.0.0"},"devDependencies":{"@umijs/test":"^3.0.5","dumi":"^1.0.17","father-build":"^1.17.2","gh-pages":"^3.0.0","lint-staged":"^10.0.7","prettier":"^2.2.1","yorkie":"^2.0.0"},"gitHead":"ed3acb05c5df998d63fa8dd7399b4d7e1d59ee55","_id":"@attorn/electron-storage@1.0.0","_nodeVersion":"14.18.1","_npmVersion":"6.14.15","dist":{"integrity":"sha512-gpA8n9X2HEfzV8BcBvMPGChFE8QLIY23A4ZHGe9tyeBrb8Cs11H06Ik4QDx4Sxl6gOPm2grELYCurEAb/QkUmA==","shasum":"4e340d1cc59a35c089a1e1c8797ce2c9bf7dc873","tarball":"https://registry.npmjs.org/@attorn/electron-storage/-/electron-storage-1.0.0.tgz","fileCount":23,"unpackedSize":23784,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDa/xmMuilbE0XbOUsfAhTRFb95mUJkqBHilznmdK2grwIgRT6yGxyAlfT8jk7i2KvVoqazik4sbPki0fOkZ182VCE="}]},"_npmUser":{"name":"attorn","email":"qafoori@yahoo.com"},"directories":{},"maintainers":[{"name":"attorn","email":"qafoori@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/electron-storage_1.0.0_1635199521305_0.22670863500180283"},"_hasShrinkwrap":false},"1.0.1":{"private":false,"name":"@attorn/electron-storage","version":"1.0.1","description":"#### The `@attorm/electron-storage` package The `@attorm/electron-storage` package is a really light, simple and convenient package that has been implemented for use in the `Attorn` project.  Because the `Attorn` project has a significant number of differ","main":"dist/index.js","repository":{"type":"git","url":"git+https://github.com/attorn/-attorn-react-explorer.git"},"author":{"name":"qafoori"},"license":"MIT","bugs":{"url":"https://github.com/attorn/-attorn-react-explorer/issues"},"homepage":"https://github.com/attorn/-attorn-react-explorer#readme","scripts":{"dev":"dumi dev","docs:build":"dumi build","docs:deploy":"gh-pages -d docs-dist","build":"father-build","deploy":"npm run docs:build && npm run docs:deploy","release":"npm run build && npm publish","prettier":"prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"","test":"umi-test","test:coverage":"umi-test --coverage"},"module":"dist/index.esm.js","typings":"dist/index.d.ts","gitHooks":{"pre-commit":"lint-staged"},"lint-staged":{"*.{js,jsx,less,md,json}":["prettier --write"],"*.ts?(x)":["prettier --parser=typescript --write"]},"dependencies":{"electron":"^15.3.0","fs":"^0.0.1-security","path":"^0.12.7","react":"^16.12.0 || ^17.0.0"},"devDependencies":{"@umijs/test":"^3.0.5","dumi":"^1.0.17","father-build":"^1.17.2","gh-pages":"^3.0.0","lint-staged":"^10.0.7","prettier":"^2.2.1","yorkie":"^2.0.0"},"gitHead":"64d10457e65271aefb6d9d5e6dd6c0afec22fe43","_id":"@attorn/electron-storage@1.0.1","_nodeVersion":"14.18.1","_npmVersion":"6.14.15","dist":{"integrity":"sha512-g1Pq7Roy8nb2meJ/EYXThbiJsTNDd7ZxMgnFU6xoaEoMO5YCrOBxfIjLeUvZssA0M7cN/j4R8XOLGhxPxXr9iQ==","shasum":"3c58da18cc400f6d659b66ba1985944614ae549b","tarball":"https://registry.npmjs.org/@attorn/electron-storage/-/electron-storage-1.0.1.tgz","fileCount":23,"unpackedSize":25939,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC6EI6HpSZ8G4ZxWE++1mjUggwts4VuOC88DNNEj6dIIAIhAKtnG2opsiI1aq/FBcihzUPR7LeYZYcgZfcOwZgInVn5"}]},"_npmUser":{"name":"attorn","email":"qafoori@yahoo.com"},"directories":{},"maintainers":[{"name":"attorn","email":"qafoori@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/electron-storage_1.0.1_1635274100681_0.2274029892535716"},"_hasShrinkwrap":false},"1.0.2":{"private":false,"name":"@attorn/electron-storage","version":"1.0.2","description":"#### The `@attorm/electron-storage` package The `@attorm/electron-storage` package is a really light, simple and convenient package that has been implemented for use in the `Attorn` project.  Because the `Attorn` project has a significant number of differ","main":"dist/index.js","repository":{"type":"git","url":"git+https://github.com/attorn/-attorn-react-explorer.git"},"author":{"name":"qafoori"},"license":"MIT","bugs":{"url":"https://github.com/attorn/-attorn-react-explorer/issues"},"homepage":"https://github.com/attorn/-attorn-react-explorer#readme","scripts":{"dev":"dumi dev","docs:build":"dumi build","docs:deploy":"gh-pages -d docs-dist","build":"father-build","deploy":"npm run docs:build && npm run docs:deploy","release":"npm run build && npm publish","prettier":"prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"","test":"umi-test","test:coverage":"umi-test --coverage"},"module":"dist/index.esm.js","typings":"dist/index.d.ts","gitHooks":{"pre-commit":"lint-staged"},"lint-staged":{"*.{js,jsx,less,md,json}":["prettier --write"],"*.ts?(x)":["prettier --parser=typescript --write"]},"dependencies":{"electron":"^15.3.0","fs":"^0.0.1-security","path":"^0.12.7","react":"^16.12.0 || ^17.0.0"},"devDependencies":{"@umijs/test":"^3.0.5","dumi":"^1.0.17","father-build":"^1.17.2","gh-pages":"^3.0.0","lint-staged":"^10.0.7","prettier":"^2.2.1","yorkie":"^2.0.0"},"gitHead":"7949da9160e34d2c22c02639268fe9b8da04a0c0","_id":"@attorn/electron-storage@1.0.2","_nodeVersion":"14.18.1","_npmVersion":"6.14.15","dist":{"integrity":"sha512-ZSjns/dYvQU4/T8FUxhy2Nn5C+pyAxwOnAUVwbVjZd9vw6fs7hrtfGYCsmdX7EU/LqJ9QBkRPm4AhYro73+pBw==","shasum":"d51f89f986cc37410542185fa7cc6f4a5355248c","tarball":"https://registry.npmjs.org/@attorn/electron-storage/-/electron-storage-1.0.2.tgz","fileCount":23,"unpackedSize":25941,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDrRvPAveP2ZCSV83r/hXhbYifFZaKip5/srVEbtlbLawIhAOuBtaYCrlixpvE/4A5yRKWLOAWXL869PetrGdvIEDl9"}]},"_npmUser":{"name":"attorn","email":"qafoori@yahoo.com"},"directories":{},"maintainers":[{"name":"attorn","email":"qafoori@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/electron-storage_1.0.2_1635279420665_0.5238384280360149"},"_hasShrinkwrap":false},"2.0.0":{"private":false,"name":"@attorn/electron-storage","version":"2.0.0","description":"A really light wight and convenient package that has been implemented for you to manage your users data through an electron application","main":"dist/index.js","repository":{"type":"git","url":"git+https://github.com/attorn/-attorn-react-explorer.git"},"author":{"name":"qafoori"},"license":"MIT","bugs":{"url":"https://github.com/attorn/-attorn-react-explorer/issues"},"homepage":"https://github.com/attorn/-attorn-react-explorer#readme","scripts":{"build":"father-build"},"module":"dist/index.esm.js","typings":"dist/index.d.ts","gitHooks":{"pre-commit":"lint-staged"},"lint-staged":{"*.{js,jsx,less,md,json}":["prettier --write"],"*.ts?(x)":["prettier --parser=typescript --write"]},"dependencies":{"electron":"^15.3.0","fs":"^0.0.1-security","path":"^0.12.7","react":"^16.12.0 || ^17.0.0"},"devDependencies":{"@umijs/test":"^3.0.5","dumi":"^1.0.17","father-build":"^1.17.2","gh-pages":"^3.0.0","lint-staged":"^10.0.7","prettier":"^2.2.1","yorkie":"^2.0.0"},"gitHead":"7f87104ad1dda3cd2f0ca9bd764cdbed0e34ba95","_id":"@attorn/electron-storage@2.0.0","_nodeVersion":"14.18.1","_npmVersion":"6.14.15","dist":{"integrity":"sha512-7eiWkuWRkCuUE9sEvn8YqnhM5y2qR6mT6tjKG3yGoYM0w702CGszr1gVRbOf4jShigez8R54RgCS4y2BLFDi5A==","shasum":"01ee0abe4e0f135d665a19ecd649959914cc593e","tarball":"https://registry.npmjs.org/@attorn/electron-storage/-/electron-storage-2.0.0.tgz","fileCount":32,"unpackedSize":67373,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDXBXszWfVvxa1pmplV+BTtciWmC9Yugcha+Wao3F9maAIgGxsyZGHX9DWY7NOE3W3asGs9FZnUsV9EWlfnmCTEAs8="}]},"_npmUser":{"name":"attorn","email":"qafoori@yahoo.com"},"directories":{},"maintainers":[{"name":"attorn","email":"qafoori@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/electron-storage_2.0.0_1635542842671_0.7536154083917666"},"_hasShrinkwrap":false},"2.0.1":{"name":"@attorn/electron-storage","author":{"name":"qafoori"},"version":"2.0.1","description":"A really light wight and convenient package that has been implemented for you to manage your users data through an electron application","homepage":"https://github.com/attorn/-attorn-react-explorer#readme","license":"MIT","private":false,"main":"dist/index.js","types":"dist/index.d.ts","bugs":{"url":"https://github.com/attorn/-attorn-react-explorer/issues"},"repository":{"type":"git","url":"git+https://github.com/attorn/-attorn-react-explorer.git"},"keywords":["electron","nodejs","storage","fs","electron-storage","attorn"],"scripts":{"build":"tsc","prepare":"npm run build"},"dependencies":{"electron":"^15.3.0","fs":"^0.0.1-security","path":"^0.12.7"},"devDependencies":{"typescript":"^4.4.4"},"gitHead":"a1f0aced38c722e51fc0dc15ea93b2fddac501d9","_id":"@attorn/electron-storage@2.0.1","_nodeVersion":"14.18.1","_npmVersion":"6.14.15","dist":{"integrity":"sha512-HCtpX0wrhZlHxKr9kXJ3GmkoRoM38TxPmQVY/Rb/TG/K4f8xk8uWX3KZiL1BgWhMIBeYiit/eOABY9nGxIrrCw==","shasum":"d38cb665706179d96ac961e00dfb9a2678e5eaac","tarball":"https://registry.npmjs.org/@attorn/electron-storage/-/electron-storage-2.0.1.tgz","fileCount":12,"unpackedSize":38985,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFkjqk9P9NWsgSZxEKil+pYkrJpzVKN1fmWCqFsw1aAtAiAiuSkiRm70e8flpc6TQqoTAiHGAx611YEDD536pDxbLQ=="}]},"_npmUser":{"name":"attorn","email":"qafoori@yahoo.com"},"directories":{},"maintainers":[{"name":"attorn","email":"qafoori@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/electron-storage_2.0.1_1635588067994_0.6669366323223371"},"_hasShrinkwrap":false},"2.1.1":{"name":"@attorn/electron-storage","author":{"name":"qafoori"},"version":"2.1.1","description":"A really light wight and convenient package that has been implemented for you to manage your users data through an electron application","homepage":"https://github.com/attorn/-attorn-react-explorer#readme","license":"MIT","private":false,"main":"dist/index.js","types":"dist/index.d.ts","bugs":{"url":"https://github.com/attorn/-attorn-react-explorer/issues"},"repository":{"type":"git","url":"git+https://github.com/attorn/-attorn-react-explorer.git"},"keywords":["electron","nodejs","storage","fs","electron-storage","attorn"],"scripts":{"build":"tsc","prepare":"npm run build"},"dependencies":{"electron":"^15.3.0","fs":"^0.0.1-security","path":"^0.12.7"},"devDependencies":{"typescript":"^4.4.4"},"gitHead":"203853bca4a469694879129deb0144c4836961ce","_id":"@attorn/electron-storage@2.1.1","_nodeVersion":"14.18.1","_npmVersion":"6.14.15","dist":{"integrity":"sha512-xR7qN/wOWls0kwBaO6Pf2Urp7bmvyDjU6Q4hE4znaZb4yUjN1s9A0R4t2sDyOUz51Sl44MIZi4Xk95qM7E09pg==","shasum":"eb27a4063cc4dcd409b58508270fd2ac2b0a0fee","tarball":"https://registry.npmjs.org/@attorn/electron-storage/-/electron-storage-2.1.1.tgz","fileCount":12,"unpackedSize":40168,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhzGjPCRA9TVsSAnZWagAAgTAQAIKefbWOACSRbve2F0ZC\ngXUVtm6LYEc4QOeAlrcB3NMUJUYh24p9lbEEarFGbWliNUVJQE2H6WEfcEKk\n32TUGmXQcpdudVJpNgSpY1u2BDdQ3Hz//s2jo/iABcDxmQfgIXOO0uYKB4v/\nwbEM1DpR1BxbAcwyXyy11S+kJKdiIpKUXobjSC/Ie3A8k6nTelgW2etvtd19\nZ7RRVQZ8poFytdUKiYFX550yIj0lgd7zjJNneRA1XojeYBh43oRQDFaKHkdG\nFTcduKYppq9xEIKgZq0CiRqSlNXMfohxGYmqdIURFuXlR3RIlzfk5oiRMIP9\nYDySPIDIjg78DlKln4Cv1g2Jdi/xiLNeAItcBHzGcp0pzhY/JWJP56SxzUFJ\nuFisgsNg3a8Vi4bSCzBOTr4dX0zF+uzpfMHPXQ01DJ7erAiSQm6S8t/wA+d6\nUv1xZ5X6ICRskm0rv9OvhMEg6ZqTekx6ijxlw6sDgUSv75YFEhoexzwPInfC\nlonMK0iHusGHWUhDPPcu7EL6ukp/WFJuurQzP10/BkVyWzgn3m7MDgdlFi2m\nyuFcx77Eb9R1n4d71y0Ej30hK3RUvrfapzgbfZ5CJdCfmIwNjUG02eGqO5Ch\ndUnGh8AUqyMzPZVzcYuWStiLtYHRyGM4p5OTdEgP48kE73LYc0mMdntuvEV8\nlM5d\r\n=nLqH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDllBbq9Ba8KKDcyoDJLW150yF3dkPLKTXuJcJ0jOminwIgDBlK4HFJig6bEGor0pslIsBcrFvBBJDVRkm8owLMEzQ="}]},"_npmUser":{"name":"attorn","email":"qafoori@yahoo.com"},"directories":{},"maintainers":[{"name":"attorn","email":"qafoori@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/electron-storage_2.1.1_1635599882001_0.8876718887311914"},"_hasShrinkwrap":false}},"time":{"created":"2021-10-25T22:05:21.249Z","1.0.0":"2021-10-25T22:05:21.470Z","modified":"2022-04-04T16:20:48.054Z","1.0.1":"2021-10-26T18:48:20.827Z","1.0.2":"2021-10-26T20:17:00.840Z","2.0.0":"2021-10-29T21:27:22.832Z","2.0.1":"2021-10-30T10:01:08.170Z","2.1.1":"2021-10-30T13:18:02.254Z"},"maintainers":[{"name":"attorn","email":"qafoori@yahoo.com"}],"description":"A really light wight and convenient package that has been implemented for you to manage your users data through an electron application","homepage":"https://github.com/attorn/-attorn-react-explorer#readme","repository":{"type":"git","url":"git+https://github.com/attorn/-attorn-react-explorer.git"},"author":{"name":"qafoori"},"bugs":{"url":"https://github.com/attorn/-attorn-react-explorer/issues"},"license":"MIT","readme":"\n## Getting started\n\nThe `@attorm/electron-storage` package is a really light wight and convenient package that has been implemented for use in the `Attorn` projects.\n\nBecause the `Attorn` projects has a significant number of different packages, and in some of them file storage was used, we built this package to use it where needed in the `Attorn` projects.\n\n  \n\nYou can also use it in your electron projects by reading these documents and understanding how `@attorm/electron-storage` works.\n\n  \n\n  \n\n## Installation\n\n  \n\nUsing yarn (strongly recommended):\n```bash\nyarn add @attorn/electron-storage\n```\nOr using npm:\n```bash\nnpm i @attorn/electron-storage\n```\n\n \n\n## HOW TO USE\nThis examples shows how to use this package in your electron application:\n\n### 1. Import package\nYou'll have two way to import `Electronstorage` into your app.\n1. With webpack configuration (strongly recommended):\n\n```ts\nimport { ElectronStorage } from  '@attorn/electron-storage';\n// or\nimport customName from '@attorn/electron-storage';\n```\n2. With common javascript module:\n\n```ts\nconst { ElectronStorage } = require('@attorn/electron-storage');\n// or\nconst customName = require('@attorn/electron-storage');\n```\n \n### 2. When you create instance\nYou have one required configuration and three optional configurations when you are making the instance of `Storage` class.\n\n 1. **name**\n\t -  *required*: true\n\t - *default*: not specified\n\t - *type*: `string`\n\t- *description*: this is the name of the storage space you want to create. This can be a simple name like “user-theme-preferences” (which will create the storage directly in “defaultPath”) or you can pass multiple names with forward slashes like “user/preferences/theme” to create directories first. Note that the last name is the file name (theme.json) and the previous names are the names of the folders that contain it\n\n2. **defaults**\n\t -  *required*: false\n\t - *default*: {}\n\t - *type*: `object(  [name: string]: string | number | boolean | object  )`\n\t- *description*: It is an optional argument. you can pass an object by this argument to store that object by default\n3. **defaultPath**\n\t -  *required*: false\n\t - *default*: userData\n\t - *type*: `'home' | 'appData' | 'userData' | 'cache' | 'temp' | 'exe' | 'module' | 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos' | 'recent' | 'logs' | 'crashDumps'`\n\t- *description*: By default. it is \"userData\" which is defined below:\n\t\t\tIn Linux OS: `~/.config/<Your App Name>`\n\t\t\tIn Windows OS: `C:\\Users\\<you>\\AppData\\Local\\<Your App Name>`\n\t\t\tIn Mac OS: `~/Library/Application Support/<Your App Name>`\n\t\t\tbut you can choose other directories (defined above (type))\n4. **instantCreate**\n\t -  *required*: false\n\t - *default*: false\n\t - *type*: `boolean`\n\t- *description*: It is \"false\" by default. if \"true\", you will receive the storage location when you create the instance of this class. But if it is \"false\", you can use the \"create\" method later to create the storage\n\n\n### 3. When you want to use instance\nIn this package, there are 8 efficient methods, the description of which you can see below:\n\n1. `create(): void`\nIf you do not want to set the actual `instantCreate` value at the build time (constructor), you can easily call this method whenever you want. It creates the storage space you want.\n\nExample:\n```ts\nimport { ipcMain } from  'electron';\nimport { Storage } from  '@attorn/electron-storage';\n\nipcMain.on('method-create', () => {\n   const store = new Storage({\n      name: 'examples/methods/create',\n      defaults: {\n         foo: 'bar',\n         bar: {\n            foo: 'baz',\n            baz: 'foo'\n         }\n      },\n      defaultPath: 'downloads',\n   });\n   \n   store.create();\n});\n```\n2. `read<T  extends string  |  number  |  boolean  |  object>(wanted?: string): T | null`\nYou can get the value(s) which already exists in a storage space with this method.\n*`wanted`*: If you specify this argument, you can get a specified value of a storage space. This can be a simple name like \"myKey\" (which only has access to the first level of an object) or you can pass multiple names with dots like \"myKey1.myKey2.myKey3\" to penetrate the inner levels and get the value.\nBy default returns `AttornElectronStorage.ValueType` but you can use generic types to specify the exact type\n\nExample:\n```ts\nimport { ipcMain } from  'electron';\nimport { Storage } from  '@attorn/electron-storage';\n\ntype MySchema = { bar: { foo: baz: string } };\n\nipcMain.on('method-read', () => {\n   const store = new Storage({\n      name: 'examples/methods/read',\n      defaults: {\n         bar: {\n            foo: {\n               baz: 'temp'\n            }\n         }\n      },\n      instantCreate: true\n   });\n      \n   const fullData = store.read<MySchema>();\n   // bar { foo: { baz: 'temp' } }\n   \n   const specificKey = store.read<string>('bar.foo.baz');\n   // 'temp'\n});\n```\n\n3. `destroyFile(fileName: string): void`\nYou can use this method to remove an existing file (means storage)\n*`fileName`*: To specify which file you want to destroy in the directory. Note that if you want to use this method, when creating a new instance of the class, if you want to use `/` between directory names, do not specify the file name there and specify only the names of the folders that contain that file you want to destroy.\n\nExample:\n```ts\nimport { ipcMain } from  'electron';\nimport { Storage } from  '@attorm/electron-storage';\n\nipcMain.on('method-destroy-file', () => {\n   // if you have \"~/.config/<Your App Name>/examples/methods/destroyFile.json\", you can do:\n   \n   const store = new  Storage({\n      name: 'examples/methods',\n   });\n   \n   store.destroyFile('destroyFile');\n   \n   // now you have \"~/.config/<Your App Name>/examples/methods\"\n});\n```\n4. `destroyFolder(safely: boolean = true): void`\nUsing this method, you can destroy a folder, no matter how nested that file is.\n*`safely`*: For added security, this argument is set to `true` by default. If `safely` is `true`, folders that contain things cannot be destroyed. But to ignore this security, you can pass the `false` value to this method to forcefully destroy that folder\n\nExample:\n```ts\nimport { ipcMain } from  'electron';\nimport { Storage } from  '@attorm/electron-storage';\n\nipcMain.on('method-destroy-folder', () => {\n   // if you have \"~/.config/<Your App Name>/examples/methods/destroyFile.json\", you can do:\n   \n   const  store  =  new  Storage({\n      name:  'examples/methods',\n   });\n   \n   store.destroyFolder();\n   \n   // because \"methods\" contains \"destroyFile.json\" you can not delete \"methods\" but if go like this:\n   store.destroyFolder(true);\n   // you will have \"~/.config/<Your App Name>/examples\"\n});\n```\n5. `update(replace:  string, by:  string  |  number  |  boolean  |  object):  void`\nThis is a very practical method. When you want to change a value in an existing data (no matter how nested the key to that value), you can use the method.\n*`replace`*: This is the path of that key you want to change the value of. This can be a simple name like `myKey` (which only has access to the first level of an object) or you can pass multiple names with dots (`.`) like `myKey1.myKey2.myKey3` to penetrate the inner levels and get the value.\n\nExample:\n```ts\nimport { ipcMain } from  'electron';\nimport { Storage } from  '@attorm/electron-storage';\n\nipcMain.on('method-update', () => {\n   const  store  =  new  Storage({\n      name:  'examples/methods/update',\n      defaults: {\n         foo:  'bar',\n         bar: {\n            foo:  'baz'\n         }\n      },\n      instantCreate:  true\n   });\n   // { foo: 'bar', bar: { foo: 'baz' } }\n   \n   store.update('foo.bar.foo', 'somethingElse');\n   // { foo: 'bar', bar: { foo: 'somethingElse' } }\n});\n```\n6. `rename(newName:  string):  void`\nUse this method to rename an existing file in the storage.\n*`newName`*: This name will be replaced with a pre-existing name. Note that unlike the `destroyFile` method, if you want to use `/` between names, you must specify the file name.\n\nExample:\n```ts\nimport { ipcMain } from  'electron';\nimport { Storage } from  '@attorm/electron-storage';\n\nipcMain.on('method-rename', () => {\n   const  store  =  new  Storage({\n      name:  'examples/methods/rename',\n      instantCreate:  true\n   });\n   // now you have \"~/.config/<Your App Name>/examples/methods/rename.json\"\n   \n   store.rename('newNameGoesHere');\n   // now you should have \"~/.config/<Your App Name>/examples/methods/newNameGoesHere.json\"\"\n});\n```\n\n7. `empty(): void`\nUsing this method you can completely clear the values in a storage space and make it the default. The default is `{}`\n\nExample:\n```ts\nimport { ipcMain } from  'electron';\nimport { Storage } from  '@attorm/electron-storage';\n\nipcMain.on('method-empty', () => {\n   const  store  =  new  Storage({\n      name:  'examples/methods/empty',\n      defaults: {\n         foo: 'bar',\n         bar: {\n            foo: 'baz'\n         }\n      },\n      instantCreate:  true\n   });\n   // { foo: 'bar', bar: { foo: 'baz' } }\n   \n   store.empty();\n   // { }\n});\n```\n8. `list():  string[]`\nWith this method you can get everything that is in a storage space (folder).\n```ts\nimport { ipcMain } from  'electron';\nimport { Storage } from  '@attorm/electron-storage';\n\nipcMain.on('method-list', () => {\n\t// if you have \"create.json\", \"read.json\" and \"update.json\" in \"examples/methods\" directory.\n   const  store  =  new  Storage({\n      name:  'examples/methods',\n   });\n   \n   // by calling \"list\" method\n   const items = store.list();\n   // you will get:\n   // ['create.json', 'read.json', 'update.json']\n});\n```\n\n### License\nThe `@attorn/electron-storage` is [MIT licensed](https://github.com/attorn/-attorn-electron-storage/blob/main/LICENSE)\n","readmeFilename":"README.md","keywords":["electron","nodejs","storage","fs","electron-storage","attorn"]}