NSFileWrapperMBS class

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

NSFileWrapperMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Cocoa Text MBS MacBase Plugin 15.0 ✅ Yes ❌ No ❌ No ✅ Yes All
The NSFileWrapper class provides access to the attributes and contents of file-system nodes.
Example
// insert a file to textview

Public Sub InsertFile(textview as NSTextViewMBS, f as FolderItem)
// read to file
dim b as BinaryStream = BinaryStream.Open(f)
dim s as string = b.Read(b.Length)

// build wrapper
dim fileWrapper as NSFileWrapperMBS = NSFileWrapperMBS.initRegularFileWithContents(s)
fileWrapper.preferredFilename = f.name

// make attachment
dim fileAttachment as new NSTextAttachmentMBS(fileWrapper)
dim attributedString as NSAttributedStringMBS = NSAttributedStringMBS.attributedStringWithAttachment(fileAttachment)

// add to a NSTextViewMBS
textview.insertText attributedString

End Sub

A file-system node is a file, directory, or symbolic link. Instances of this class are known as file wrappers.

File wrappers represent a file-system node as an object that can be displayed as an image (and possibly edited in place), saved to the file system, or transmitted to another application.

There are three types of file wrappers:


A file wrapper has these attributes:

Reading Options

Constant Value Description
NSFileWrapperReadingImmediate 1 If reading with this option succeeds, then subsequent uses of fileWrappers, regularFileContents, symbolicLinkDestinationURL, and serializedRepresentation sent to the file wrapper and all its child file wrappers will fail and return nil only if an actual error occurs (for example, the volume has disappeared or the file server is unreachable)—not as a result of the user moving or deleting files. more
NSFileWrapperReadingWithoutMapping 2 Whether file mapping for regular file wrappers is disallowed. more

Writing Options

Constant Value Description
NSFileWrapperWritingAtomic 1 Whether writing is done atomically. more
NSFileWrapperWritingWithNameUpdating 2 Whether descendant file wrappers’filename properties are set if the writing succeeds. more

This class has no sub classes.

Some methods using this class:

Some properties using for this class:

Blog Entries


The items on this page are in the following plugins: MBS MacBase Plugin.


NSFileVersionMBS   -   NSFontDescriptorMBS


💬 Ask a question or report a problem