syft/examples
Kudryavcev Nikolay f5c765192c
Refactor fileresolver to not require base path (#4298)
* ref: close source in test and examples

Signed-off-by: Kudryavcev Nikolay <kydry.nikolau@gmail.com>

* ref: pretty file/directory source resolver (make them more similar)

Signed-off-by: Kudryavcev Nikolay <kydry.nikolau@gmail.com>

* ref: move absoluteSymlinkFreePathToParent to file resolver

Signed-off-by: Kudryavcev Nikolay <kydry.nikolau@gmail.com>

* revert breaking change

Signed-off-by: Kudryavcev Nikolay <kydry.nikolau@gmail.com>

---------

Signed-off-by: Kudryavcev Nikolay <kydry.nikolau@gmail.com>
2025-10-29 10:41:18 -04:00
..
2024-02-02 16:26:44 +00:00
2024-02-02 16:26:44 +00:00

Syft API Examples

This directory contains examples of how to use the Syft API.

  • create_simple_sbom: Create a simple SBOM from scratch
  • create_custom_sbom: Create an SBOM using as much custom configuration as possible, including a custom cataloger implementation
  • decode_sbom: Take an existing SBOM file (of arbitrary format) and decode it into a Syft SBOM object
  • source_detection: Shows how to detect what to catalog automatically from a user string (e.g. container image vs directory)
  • source_from_image: Construct a source from a only a container image

You can run any of these examples from this directory with:

go run ./DIRECTORY_NAME