Skip to content

Commit

Permalink
Add SetExtendedAttrs to Client
Browse files Browse the repository at this point in the history
Add function to set extended attributes in the sftp client.

Signed-off-by: Peter Verraedt <[email protected]>
  • Loading branch information
peterverraedt committed Apr 25, 2024
1 parent 6370888 commit 07fd48c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,16 @@ func (c *Client) Truncate(path string, size int64) error {
return c.setstat(path, sshFileXferAttrSize, uint64(size))
}

// SetExtendedAttrs sets the extended attributes of the named file.
func (c *Client) SetExtendedAttrs(path string, extended []StatExtended) error {
type extendedAttrs struct {
Size uint32
Extended []StatExtended
}
attrs := extendedAttrs{Size: uint32(len(extended)), Extended: extended}
return c.setstat(path, sshFileXferAttrExtended, attrs)
}

// Open opens the named file for reading. If successful, methods on the
// returned file can be used for reading; the associated file descriptor
// has mode O_RDONLY.
Expand Down

0 comments on commit 07fd48c

Please sign in to comment.