% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/read_write_sframe.R
\name{write_sframe}
\alias{write_sframe}
\title{Write an instrument to a .sframe file}
\usage{
write_sframe(instrument, path, pretty = TRUE, overwrite = FALSE)
}
\arguments{
\item{instrument}{An \code{sframe} object created by \code{\link[=sf_instrument]{sf_instrument()}}.}

\item{path}{Character. The file path to write to. The \code{.sframe} extension
is appended automatically if not already present.}

\item{pretty}{Logical. Whether to write formatted JSON with indentation.
Defaults to \code{TRUE}. Set to \code{FALSE} for compact files.}

\item{overwrite}{Logical. Whether to overwrite an existing file. Defaults
to \code{FALSE}.}
}
\value{
The file path, invisibly.
}
\description{
Serialises an \code{sframe} instrument object to a UTF-8 JSON file with a
SHA-256 integrity hash. The instrument is validated before writing unless
the object already carries a valid status. The hash is computed over the
full serialised content with the \code{hash.value} field set to an empty string.
}
\examples{
instr <- read_sframe(
  system.file("extdata", "tourism_services_demo.sframe",
              package = "surveyframe")
)
out <- write_sframe(instr, tempfile(fileext = ".sframe"))
file.exists(out)
}
\seealso{
\code{\link[=read_sframe]{read_sframe()}}, \code{\link[=validate_sframe]{validate_sframe()}}
}
