Skip to content

Commit

Permalink
updated the readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
nimesh0505 committed Sep 10, 2024
1 parent 513b8c4 commit da2fb25
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -437,13 +437,12 @@ Assume this structure with the compressed asset as a sibling of the un-compresse

#### Disable serving and CWD behavior

If you would just like to use the reply decorator and not serve whole directories automatically, you can simply pass the option `{ serve: false }`. This will prevent the plugin from serving everything under `root`.
If you want to use only the reply decorator without automatically serving whole directories, pass the option `{ serve: false }`. This prevents the plugin from serving everything under `root`.

When `serve: false` is passed:
When `serve: false` is used:

1. The plugin will not perform the usual directory existence check for the `root` option.
2. If no `root` is provided, the plugin will default to using the current working directory (CWD) as the root.
3. A warning will be logged if no `root` is provided, informing that the CWD is being used as the default.
- If no `root` is provided, the plugin will use the current working directory (CWD) as the default root.
- The `sendFile` method will send files relative to the CWD or the specified `root`.

Example usage:

Expand All @@ -463,7 +462,7 @@ fastify.get('/file', (req, reply) => {
})
```

This configuration allows you to use the `sendFile` decorator without automatically serving an entire directory, giving you more control over which files are accessible.
This configuration allows you to use the `sendFile` decorator without automatically serving an entire directory.

#### Disabling reply decorator

Expand Down

0 comments on commit da2fb25

Please sign in to comment.