@@ -270,6 +270,33 @@ db.writeAll(newData, (err) => {
270270});
271271```
272272
273+ ### Promise-based API
274+
275+ All methods have async counterparts that return Promises. Simply add ` Async ` to the method name:
276+
277+ #### Async Method Names
278+
279+ All callback methods have async counterparts. Add ` Async ` to the method name:
280+
281+ ``` javascript
282+ // Using async/await
283+ try {
284+ const user = await db .createAsync ({ name: ' John' , age: 30 });
285+ const allUsers = await db .readAllAsync ();
286+ const foundUser = await db .findByIdAsync (user .id );
287+ const updatedUser = await db .updateAsync (user .id , { age: 31 });
288+ await db .deleteAsync (user .id );
289+ } catch (error) {
290+ console .error (' Operation failed:' , error .message );
291+ }
292+
293+ // Using Promises
294+ db .createAsync ({ name: ' Jane' , age: 25 })
295+ .then (user => db .findByIdAsync (user .id ))
296+ .then (foundUser => console .log (' Found:' , foundUser))
297+ .catch (error => console .error (' Error:' , error .message ));
298+ ```
299+
273300## Advanced Features
274301
275302### Unique Fields
@@ -319,6 +346,7 @@ For comprehensive examples, see the [examples](./examples/) directory:
319346- ** [ Basic Usage] ( ./examples/basic-usage.js ) ** - Simple CRUD operations
320347- ** [ Advanced Features] ( ./examples/advanced-usage.js ) ** - Concurrent operations, filtering, custom ID fields
321348- ** [ User Management] ( ./examples/user-management.js ) ** - Real-world application with unique fields validation
349+ - ** [ Async/Await Demo] ( ./examples/async-demo.js ) ** - Promise-based API usage with async/await
322350
323351### Quick Examples
324352
@@ -382,7 +410,6 @@ Contributions are welcome! Here are some ways you can help improve JsonFileCRUD:
382410
383411### Ideas for Contributions
384412
385- - ** Async/Await Support** : Add Promise-based API alongside callbacks
386413- ** Batch Operations** : Add bulk insert/update/delete operations
387414- ** File Locking** : Add file locking for multi-process safety
388415- ** Enhanced Documentation** : Improve documentation and add more examples
@@ -399,4 +426,3 @@ Contributions are welcome! Here are some ways you can help improve JsonFileCRUD:
399426## License
400427
401428MIT License - see [ LICENSE] ( ./LICENSE ) file for details.
402-
0 commit comments